
16 Aug
2006
16 Aug
'06
8:10 a.m.
Lets say I have several types t1, t2, t3, and so on. Each of them has a typedef x within it. I want to be able to get a type y, and find the type t which holds is_same<y, t::x>. I thought of doing it using mpl::map< pair<t1::x, t1>, pair<t2::x, t2>, ...>. The problem is how to create the map. I can create it manually, just like in the previous sentence, but I hope there's a better way. Is there some transform algorithm that I can pass it an mpl::set<t1, t2, ...> and a meta-function that yields t::x for any given t, and this algorithm would produce the desired map? Thanks, Yuval