Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2007-04-19 19:03:46


Joel,

Thanks for answer. That idea came to my mind after Ken's post. I will test
it tomorrow.

Best Regards,
Ovanes

-----Ursprüngliche Nachricht-----
Von: Joel de Guzman [mailto:joel_at_[hidden]]
Gesendet: Freitag, 20. April 2007 00:44
An: boost-users_at_[hidden]
Betreff: Re: [Boost-users] Static typing question

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 mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

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