Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 1999-10-08 14:07:09


niko_pro_at_[hidden] wrote:

> Is there any way in which i can make regular_map have key_type as its
> key and iterator to reverse_map as its value_type, and reverse_map has
> value_type as its key and iterator to regular_map as its value type.
> Something like :
>
> typedef map<key_type, XXXX /*itarator of reverse_map*/> regular_map;
> typedef multimap<value_type, regular_map::iterator> reverse_map;
>
> 'On the face of it' it looks easy but the declaration is 'recursive'.

No need to use quotes. This is really a recursive definition.

You don't need iterators:

typedef pair<key1, key2> value_type;
typedef map<key1, key2> m1_t;
typedef map<key2, key1> m2_t;

and then an erase (keyn) takes two lookups, and
erase (iteratorn) takes one. Is it such a big deal ?

-- 
Valentin Bonnard

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk