S
shaun roe
Its the weekend so I have time to wax lyrical.
Thanks for the many answers and the discussion. I understand it is
generally dangerous to inherit from containers in STL, and not
inheriting in this way is a good general philosophy. Which is a shame,
since a technical detail of the language prevents preserving the idiom
embedded in much of STL and extending these well written, optimized,
classes in a natural way. But thats life.
However with a little more knowledge of the implicit problems, I think
it should be possible to weigh up the relevant dangers and be more
flexible: Given that bitset<> has method to_ulong, what could be more
natural than to have to_ulonglong (see ps at end) and maintain the idiom?
What is the probability in my application of the extended bitset being
called, destroyed polymorphically from a pointer to bitset<64>?
Infinitesimally small. Does my whimsical wish to preserve the style of
bitset outweigh this danger? In this case, probably.
So I'll commit my code to the project with a big doxygen warning and see
whether my evil misformed progeny trips anyone up...
thanks
shaun
ps: yes, I know standard C++ doesnt have an unsigned long long. This
wasn't my design choice. But its there, I have to live with it, and who
knows, maybe one day it will be part of the standard. "'to author' a
piece of code" (as opposed to "to write...") used to be an appalling
slaughter of the english language, but has become standard; and I'm told
that one can even find 'bodilicious' in the Oxford English Dictionary.
Thanks for the many answers and the discussion. I understand it is
generally dangerous to inherit from containers in STL, and not
inheriting in this way is a good general philosophy. Which is a shame,
since a technical detail of the language prevents preserving the idiom
embedded in much of STL and extending these well written, optimized,
classes in a natural way. But thats life.
However with a little more knowledge of the implicit problems, I think
it should be possible to weigh up the relevant dangers and be more
flexible: Given that bitset<> has method to_ulong, what could be more
natural than to have to_ulonglong (see ps at end) and maintain the idiom?
What is the probability in my application of the extended bitset being
called, destroyed polymorphically from a pointer to bitset<64>?
Infinitesimally small. Does my whimsical wish to preserve the style of
bitset outweigh this danger? In this case, probably.
So I'll commit my code to the project with a big doxygen warning and see
whether my evil misformed progeny trips anyone up...
thanks
shaun
ps: yes, I know standard C++ doesnt have an unsigned long long. This
wasn't my design choice. But its there, I have to live with it, and who
knows, maybe one day it will be part of the standard. "'to author' a
piece of code" (as opposed to "to write...") used to be an appalling
slaughter of the english language, but has become standard; and I'm told
that one can even find 'bodilicious' in the Oxford English Dictionary.