derive from STL's set::iterator
Hi !
deriving from list::iterator and vector::iterator is no problem, but how can I derive from set::iterator ?
I've tried
Code:
template < class T, class Pred = less<T>, class A = allocator< T > >
class MySetIt : public set< T, Pred, A >::iterator
{
};
set< CString* > s;
MySetIt< CString* > it;
it = s.begin(); // <= Compile error C2440
and always get the compile error C2440 (cannot convert from ... to ...)
How can I derive the iterator ?
which constructor do I have to provide ?
Thanks !!
Re: derive from STL's set::iterator
Quote:
Originally posted by corcor
Hi !
deriving from list::iterator and vector::iterator is no problem,
Yes there is a problem -- the iterator classes have no virtual destructor. You should not derive from classes that lack a virtual destructor for reasons that have been discussed here very thoroughly.
Regards,
Paul McKenzie