
Aleksey Gurtovoy wrote:
Martin Apel wrote in message news:46C19A4F.9080505@simpack.de...
Aleksey Gurtovoy wrote:
All in all, to get the behavior you want with the current library you need to actually merge two maps into a third one.
[...]
I'm not sure, if I understand this correctly. What is the recommended way of merging two maps into a third one? Is it possible with the current MPL implementation?
Sure.
I only found an map::insert metafunction to insert a single element, but not a whole range of pairs.
You can actually to do something along these lines (untested):
typedef copy< joint_view<Map1,Map2> , inserter< map0<>, insert<_1,_2> > >::type JointMap;
-- Aleksey Gurtovoy MetaCommunications Engineering
I still had no luck getting this to work. It seems that the typedef for the joint map is OK (I had to change the insert to use a third parameter as follows: typedef copy< joint_view<Map1,Map2>, inserter <map0<>, insert<_1, end<_1>::type, _2> >
::type JointMap;
otherwise it wouldn't compile). However as soon as I try to access the result using std::cout << at<JointMap, int_<2> >::type::value << "\n"; I got tons of compile errors, from at_impl.hpp like the following: error: no type named `type' in `struct boost::mpl::advance<mpl_::void_, mpl_::int_<2> >' and advance_forward.hpp:42: error: no type named `type' in `struct boost::mpl::next<mpl_::void_>' It seems that at still is not happy with the type it is given. Regards, Martin ____________ Virus checked: AVKA 17.383 from 13.08.2007