Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2006-10-12 22:34:46


"Jeff Garland" <jeff_at_[hidden]> wrote
> 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.

Still, does it really seem like a good idea to do what the designers of the
STL wanted to explicitly disallow... Why not define additional
functionality externally? (I believe there was once a library in the Boost
review queue called string_algo, or similar). This would be a better design
choice, IMO.

Regards,
Arkadiy


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