
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

On Apr 19, 2007, at 2:02 PM, 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;
The typedef just renames the type, it does not make create a unique type. You can use a struct: struct { unsigned int x } some_type; struct { unsigned int x } other_type; though this makes using the types ugly. Ken Krovchuck

Ken, Thanks for your answer. Probably I incorrectly expressed my question. I am looking for a way to generate for every typedef a unique tag type. May be I got an idea, which I must test and can post here later on. Many thanks, Ovanes -----Ursprüngliche Nachricht----- Von: Ken [mailto:krovchuck@gmail.com] Gesendet: Freitag, 20. April 2007 00:31 An: boost-users@lists.boost.org Betreff: Re: [Boost-users] Static typing question On Apr 19, 2007, at 2:02 PM, 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;
The typedef just renames the type, it does not make create a unique type. You can use a struct: struct { unsigned int x } some_type; struct { unsigned int x } other_type; though this makes using the types ugly. Ken Krovchuck _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

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
, fusion::pair > my_map; my_map my_map_(fusion::make_pair
("some_type"), fusion::make_pair ("other_type")); at_key
(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

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@boost-consulting.com] Gesendet: Freitag, 20. April 2007 00:44 An: boost-users@lists.boost.org 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
, fusion::pair > my_map; my_map my_map_(fusion::make_pair
("some_type"), fusion::make_pair ("other_type")); at_key
(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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Joel de Guzman
-
Ken
-
Ovanes Markarian