Boost logo

Boost :

Subject: Re: [boost] [system] virtual ~error_category
From: Peter Dimov (lists_at_[hidden])
Date: 2018-02-12 20:54:24


Niall Douglas wrote:

> You misunderstand me.
>
> I'm saying that there are people who make error categories via a factory,
> one per payload carried, and they attach them to a custom error_code whose
> destructor cleans up the bespoke error category.

Even if you only use your own custom error codes, you still need either to
reference count the category, or to clone it in the copy constructor. You
can't just delete it blindly because you don't know how many copies of the
error code have been done. And either approach requires you to store not
error_category* but your_error_category*, where your_error_category is a
base class that derives from error_category.

This _is_ silent breakage though as ~your_error_category was virtual by
inheritance before and no longer will be.

Not how error_category was supposed to be used but what can you do. If it's
there, people will take advantage of it. :-/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk