Re: custom treemodel?

On 5/17/06, Murray Cumming <murrayc murrayc com> wrote:
>> > even cooler if it actually derived from some STL abstract type,
>> What kind of type do you mean exactly? Standard C++ containers are not
>> meant to be used as base classes. They do conform to standard
>> types/requirements, but I think those are just concepts rather than
>> actual
>> classes.
> i do this quite often actually. but what i really meant was to derive
> from the abstract classes behind the instances. e.g. Sequence, Container
> etc. rather than vector, list. these are real classes i believe.

No, I don't think so, though it might be vendor-specific:

Yes, I don't believe there's anything in the C++ standard that
specifies common base classes for any of these containers, so it's
probably very implementation-defined.

In addition, they don't have virtual destructors, which is why it's
generally not recommended to inherit from them.  So I usually end up
using composition instead of inheritance when I want to 'extend' a
standard container type, even though it is more awkward.


(all of these Paul Davises are confusing me.  we need some nicknames :)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]