Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-10-12 20:12:12


Caleb Epstein wrote:
> 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
> std::basic_string?

Yes, not having any data members in the subclass makes the destructor a no-op.
  Someone has pointed out that *technically* the behavior is undefined by the
standard. But in reality what happens is, well, nothing. The empty subclass
destructor is not called -- so there is no effect. It works on all C++
compilers that I'm aware of.

Jeff


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