Re: how to build a recursive map ?
From: jose luis fernandez diaz (jose_luis_fdez_diaz_news_at_yahoo.es)
Date: 04/20/04
- Next message: jose luis fernandez diaz: "Is posible erase element while iterating in a stl container ?"
- Previous message: Michiel Salters: "Re: g++ (3.3) bug?"
- In reply to: Karl Heinz Buchegger: "Re: how to build a recursive map ?"
- Next in thread: John Harrison: "Re: how to build a recursive map ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Apr 2004 11:03:39 -0700
Karl Heinz Buchegger <kbuchegg@gascad.at> wrote in message news:<40853AAB.18C8762@gascad.at>...
> jose luis fernandez diaz wrote:
> >
> > I want to define a map where each element is a map. Something similar to:
> >
> > map<string, map *> m1;
>
> This is not a map of maps, it is a map of pointers to maps.
> Anyway: what is your problem?
>
> lets say you have a map, which maps int to double
>
> map< int, double >
>
> you now want to build a map out of this, such that a string
> selects the map which maps int to double.
>
> map< string, map< int, double > >
I need something like this:
template<class key, class T, . . .>
class map
{
typedef Key key_type;
// typedef T mapped_type;
typedef map *mapped_type;
. . .
}
map<string> m1;
m1["one"] = NULL;
m2["two"] = m1;
but I think that it is not posible.
I tried to simulate it with:
map<string, map<string, map<string ... string> . . . > m_n;
m_1["one"] = "zero";
m_2["two"] = m1["one];
. . .
m_n["n"] = n_n_1["n-1"];
but this is ugly.
Regards,
Jose Luis.
- Next message: jose luis fernandez diaz: "Is posible erase element while iterating in a stl container ?"
- Previous message: Michiel Salters: "Re: g++ (3.3) bug?"
- In reply to: Karl Heinz Buchegger: "Re: how to build a recursive map ?"
- Next in thread: John Harrison: "Re: how to build a recursive map ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|