> >> Inheriting will mostlikely not work well, wrapping might work, > >> > | Mind telling me why? > > std::string does not have a virtual destructor. It has never been > inteded for inheritence. > I'm only thinking of doing something like this:
size_t asserter_string::size() { assert(...); return string::size(); } (besides from the fact that std::string::size() probably wouldn't need an assert) There would be no need to add additional member variables, so a lack of a virtual destructor should not be a problem. A comment might be added to the file to point this out.