From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-10-13 04:34:22
[mailto:boost-bounces_at_[hidden]] On Behalf Of Caleb Epstein Sent:
12 October 2006 22:09 To: boost_at_[hidden]
Subject: Re: [boost] Boost super_string
> On 10/12/06, Arkadiy Vertleyb <vertleyb_at_[hidden]> wrote:
>> More importantly, according
>> to the standard, the basic_string class destructor is not virtual,
>> and so basic_string is not intended for derivation.
> Wouldn't this only matter if super_string added data members (it
> doesn't AFAICT)
> and was being deleted via pointers to
THIS is the relevent point.
string* pstr = new super_string;
is undefined behaviour. In practise, you get away with it if
super_string doesnt do anything in its destructor, and if all additional
members don't do anything in their destructors. However, formally it is
ALWAYS undefined behaviour.
The real question is how often will people create a super_string on the
heap, and delete it through pointer to string.
-- Martin Bonner Martin.Bonner_at_[hidden] Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB24 6WZ, ENGLAND Tel: +44 (0)1223 203894
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk