Creating a map between two sets of classes

Hi, I have a requirement where in i have a set of classes and they have a one on one correspondence with another set of classes. Consider something like this a) template<class A> class Walkers { int walk( Context<A>* context ); }; The set of Context classes are not templates. They are individual classes. I need to create a mapping between these two sets. One way, i could think of is to create a typelist and refer to the class at the appropriate location. But i feel that is more error prone, as i may mismatch the Contexts in the typelist. Can someone advise me how to do this using any of the boost libraries? Thanks, Gokul.

AMDG Gokulakannan Somasundaram wrote:
I have a requirement where in i have a set of classes and they have a one on one correspondence with another set of classes. Consider something like this a) template<class A> class Walkers { int walk( Context<A>* context ); };
The set of Context classes are not templates. They are individual classes. I need to create a mapping between these two sets. One way, i could think of is to create a typelist and refer to the class at the appropriate location. But i feel that is more error prone, as i may mismatch the Contexts in the typelist. Can someone advise me how to do this using any of the boost libraries?
Could you use mpl::map? I don't really understand what you're trying to do, however. In Christ, Steven Watanabe

I think, that was what i was looking for. But when i see the documentations, there are no examples. Can you please give an example of how to use mpl::map / a url where there are some examples. Thanks a lot, Gokul.
Could you use mpl::map? I don't really understand what you're trying to do, however.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Thanks, i got it. It was very helpful. Is there a similar solution to associate a member function with a class? Thanks in advance, Gokul. On Tue, Mar 2, 2010 at 1:30 AM, Gokulakannan Somasundaram < gokul007@gmail.com> wrote:
I think, that was what i was looking for. But when i see the documentations, there are no examples. Can you please give an example of how to use mpl::map / a url where there are some examples.
Thanks a lot, Gokul.
Could you use mpl::map? I don't really understand what you're trying to do, however.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

WOW!!!
There are so many ways to solve the issue in C++. Thanks a lot.
Gokul.
On Tue, Mar 2, 2010 at 8:52 AM, Steven Watanabe
AMDG
Gokulakannan Somasundaram wrote:
Thanks, i got it. It was very helpful. Is there a similar solution to associate a member function with a class?
You can store the member function in a type and use mpl::map.
template
struct mem_fun {}; In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Gokulakannan Somasundaram
-
Steven Watanabe