
Caleb Epstein wrote:
On 10/12/06, Arkadiy Vertleyb <vertleyb@hotmail.com> 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
"Jeff Garland" <jeff@crystalclearsoftware.com> wrote 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