|
Boost Users : |
From: Joel de Guzman (joel_at_[hidden])
Date: 2007-04-19 18:44:14
Ovanes Markarian wrote:
> Hello all!
>
>
> I have a question on static typing. Does someone know or can imagine a way on producing unique
> static types. An example:
>
>
> typedef unsigned int some_type;
> typedef unsigned int other_type;
>
>
> typedef fusion::map< fusion::pair<some_type, std::string>, fusion::pair<other_type, std::string> >
> my_map;
>
> my_map my_map_(fusion::make_pair<some_type>("some_type"),
> fusion::make_pair<other_type>("other_type"));
>
>
> at_key<other_type>(my_map) should return "other_type" and not "some_type"
How about using mpl::int_ or something similar? Example:
template <int ID>
struct key;
typedef key<1> tag1;
typedef key<2> tag2;
actually, you can get by with simple forward declared structs:
struct tag1;
struct tag2;
Cheers,
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net