On 14.10.2010 21:32, Steinar Bang wrote: >>>>>> Branko Čibej <br...@xbc.nu>: >> All right. Then derive svn::string from std::string, and add a .null() >> method. You get to use all the standard string alogorithm >> specializations, plus you get what you want. > There is one known objection to this: std::string doesn't have a virtual > destructor, so if you hand a pointer to your derived string off to > something that holds a std::string* and then do delete on that > std::string* you enter into "undefined behaviour" territory. > > Meaning what happens isn't defined, and different compilers can > do... interesting things.
std::string also doesn't have any virtual functions, nor does a bool member require a destructor. Memory deallocation is OK. std::string is actually a POD and tricky rules apply that allow you do do this safely, IIRC ... -- Brane