[fusion] join result

Dear boost experts, I have difficulties using the fusion join algorithm result. Here is a small sample demonstrating the problem. namespace fields { struct one ; struct two ; } typedef fusion::map < fusion::pair< fields::one, std::string >, fusion::pair< fields::two, std::string >
rec_t ;
int main() { rec_t r1( std::string( "1" ), std::string( "2" ) ) ; rec_t r2( std::string( "10" ), std::string( "20" ) ) ; typedef fusion::result_of::join< const rec_t, const rec_t >::type res_type ; res_type res = fusion::join( r1, r2 ) ; // Compile error! fusion::at_key< fields::two >( res ) = std::string( "200" ) ; std::cout << res << std::endl ; } I can not modify the map fields because they are const. I tried changing the result type from typedef fusion::result_of::join< const rec_t, const rec_t >::type res_type ; to typedef fusion::result_of::join< rec_t, rec_t >::type res_type ; but that doesn't work neither. Can somebody explain how to assign the result of a join to a variable that I can modify later using functions like at_key, erase_key,... ? Thanks

Istvan Buki wrote:
When you join a sequence, A, and another sequence, B, the result is a joint_sequence -- a view. IOTW, when you join a map and another map, the result is not a map. What you can do is to convert the view to a map using as_map(res). Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net

Istvan Buki wrote:
http://tinyurl.com/5fyy84 HTH, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net
participants (2)
-
Istvan Buki
-
Joel de Guzman