Boost logo

Boost Users :

From: Markus Werle (numerical.simulation_at_[hidden])
Date: 2008-08-29 04:31:44


Hi!

The following piece of code yields "( 0)" as output, but IMHO
the output should be "(test 1)".
Looks like at_c creates temporaries, but I expected it to
return a reference.
How can I fix this?

Markus

#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/tr1/tuple.hpp>
#include <string>
#include <iostream>

namespace fusion = boost::fusion;
namespace phoenix = boost::phoenix;

int main()
{
        typedef fusion::tuple<std::string, int> tuple_t;
        typedef std::tr1::tuple<std::string, int> tr1_tuple_t;

        tuple_t t("test", 1);
        
        tr1_tuple_t tr1_t;

        phoenix::at_c<0>(tr1_t) = phoenix::at_c<0>(t);
        phoenix::at_c<1>(tr1_t) = phoenix::at_c<1>(t);
        
        
        std::cout << tr1_t << std::endl;
}


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