
The current implementation of views do not preserve the associative-ness of the underlying sequence(s). In your specific example, the joint_view is a plain forward sequence. You could try my c++0x-port of Boost.Fusion. My implementation correctly preserves the category. You can find the code in the sandbox (https://svn.boost.org/trac/boost/browser/sandbox/SOC/2009/fusion). -Christopher er schrieb:
Hi All,
I am wondering if anyone knows of anything that resembles a joint_view of a pair of maps.
typedef mpl::int_<1> key1_; typedef mpl::int_<2> key2_;
typedef pair
pair1_; typedef pair pair2_; typedef map
map1_; typedef map map2_; map1_ m1( make_pair
(1) ); map2_ m2( make_pair (2) ); typedef joint_view< map1_, map2_ > jv_; // not supposed to compile (?), yet it does: jv_ view(m1,m2); // but not this: // at_key
(view) // I have no choice (?) but create a new map, // although view helps a bit for initializing it: typedef map< pair1_, pair2_ > map3_;
map3_ m3 = fusion::as_map(view);
int n1 = fusion::at_key
(m3); BOOST_ASSERT(n1 == 1); int n2 = fusion::at_key (m3); BOOST_ASSERT(n2 == 2);