Boost logo

Boost Users :

From: Istvan Buki (buki.istvan_at_[hidden])
Date: 2008-07-07 10:51:16


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net