Boost logo

Boost :

From: Detlef Vollmann (dv_at_[hidden])
Date: 1999-08-16 18:01:00

Andy Glew wrote:
> > Well, as we have been discussing, you can either wrap up all the
> > containers, or write just one wrapper for any iterator. I'll add
> > the latter to my to-do list for weak_ptr.
> [...]
> However, if this is not true - if an STL container can implement
> such methods "behind the curtains" in terms of other operations,
> only finally converting to the canonical external representation,
> then you have to manually code all iterator returning methods.
Hmmm, just an idea....
If you define
        template <typename container>
        class live : public container
        {public: typedef live_iterator iterator;
        ... };

and you have a ctor for live_iterator that takes the
original iterator, then this ctor could correct the
iterator returned from the container.
Your example:

        live< map< key, object* > > livemap;
        live< map< key, object* > >::iterator found;

        found = livemap.find(someKey); <= here your ctor comes in.

Detlef Vollmann
vollmann engineering gmbh           Tel: +41-41-4120911
P.O. Box 5106                       Fax: +41-41-4120912
CH-6000 Luzern 5 / Switzerland      eMail: dv_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at