I'm currently struggling with a design decision. One of my classes
(named Attributable) has a protected member of type
std::list<StrongReference<Attribute> >
Basically the list has strong references that point to Attribute's.
In Attributable i want to provide an stl like interface for
bidirectional iterators like:
Iterator Attributable::attributes_begin();
Iterator Atrributable::attributes_end();
I could easily typedef Iterator as std::list<StrongReference<Attribute>
::iterator. However,
I certainly don't want to have the user of Attributable to access the
strong reference instance.
I rather want to hide the fact that there are strong references
maintained and only provide him access to the actual Attribute pointer.
To accomplish this, the only way that comes up into my mind is to
inherit from
std::list<T>::iterator and override the operators * and ->. However
since i don't have knowledge about internals of the
std::list<T>::iterator, I doubt that this is a good idea.
Any suggestions, links etc.?
Thanks in advance,
Christoph