In article <45204129$0$8413$5a62ac22@per-qv1-newsreader-01.iinet.net.au>,
Gianni Mariani <gi3nospam@mariani.wswrote:
Quote:
>Greg Comeau wrote:
>...
Quote:
>In what way was it written to be derived from ?
>It is purposely designed to be extensible, but through templates,
>which is a different type of relationship approach.
>
>So there is nothing specific that makes the classes "designed" to not be
>inherited.
>
>So there should be no reason that these classes can't be inherited from.
>(modulo all the regular gotchas - slicing dicing and deleting from the
>wrong pointer etc...)
What? So except for the obvious normal stuff there is no reason. Uh-huh.
I guess I don't understand what you don't understand. I am not a
C++ standard library expert, but it seems to me:
* The authors have said so.
* All useful data in vector (and perhaps unuseful ones too) is private
(not that it would be public but perhaps at least protected).
* There is no virtuals.
* It seems to me that there is a disconnect between related things
such as iterators, which need to go hand in hand with it. I could be wrong.
IOWs, except for an instrumentation example given earlier (it had not
dawned on me that's what the OP was doing duh) there is not really all
that much that could be gained. So it seems to me that the extensibility
is as a template. I would probably expect a particular instantiation
to be derived from if anything but even that I guess I would think about.
Also, in such cases where a design needs to be bent, or enhanced,
I often find that more superior solutions can come about in other ways
(containment (which isn't perfect either), private inheritance,
the typedef mentioned earlier, even regular (thought perhaps template'd)
functions (aka "free functions", etc.).
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE ==
http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?