Pete Becker said:
How does listing some classes that fit this description support you
comment that the statement is misleading?
The statement is correct, but will typically be misinterpreted by
novice users. It refers to a specific category of mix-in template
classes, which most likely aren't the ones that a C++ beginner would
think of. They know about strings, streams, and containers such as the
std::bitset mentioned in the subject line -- and deriving from these
classes is unnecessary and considered harmful.
I rarely try to speak for PJ, but what he said is not mistaken. It is
literally true, and it implies a different design choice than the one
that you advocate.
Is it a matter of design choice, or a matter of different scope ?
The example classes you cited have nothing to do with the std::bitset
originally being discussed.
Publicly deriving from std::bitset would be a design choice, but
this is not what you have tried to defend, and several authors
have demonstrated that this has serious caveats. Extending the
interface of the class with non-member functions is seen as preferable,
with no drawback other than the different calling syntax.
It's reasonable to consider it, but it's not reasonable to require it.
There are more things in heaven and earth, Horatio, than are dreamt of
in your philosophy.
I wrote "guideline" and "advice", not rule. And I asked you for an
illuminating counter-example, which unfortunately you declined to provide.
I can think of designs where a destructor should be both virtual
and protected. But I can't think of a useful C++ idiom where a class that
is being derived from needs to have a public and non-virtual destructor.
I'm sure an example can be found, but how realistic would it be?
This is what I would like to find out. I would be thankful if
you, or anyone else, could post such an example.
Cheers,
Ivan