Boost logo

Boost :

From: Ivan Matek (libbooze_at_[hidden])
Date: 2024-12-21 13:46:10


On Sat, Dec 21, 2024 at 2:15 PM Andrzej Krzemienski <akrzemi1_at_[hidden]>
wrote:

>
>
>> Issue here is that you can not inherit from containers(or you can, but
>> you shouldn't). This is a well known issue in C++.
>>
>
> Could you explain what the issue is? I do not believe I have ever heard of
> it.
>
> https://github.com/isocpp/CppCoreGuidelines/issues/1232
Relevant containers do not have virtual destructor. And AFAIK there is no
way to prevent people from putting your type in unique_ptr.
IIRC some time ago I read that even if objects are of same size(i.e.
derived object has no extra members) according to standard it is UB to
delete derived using pointer to base, but I did not check in the standard.

>
>


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