id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 5408,fold(transform(.... )) gives erroneous result: dangling reference?,joe@…,Joel de Guzman,"The code below demonstrates a problem using fusion's transform on a fold view in conjunction with a phoenix functional. It produces the output: Should be the same: 1 =? 4.59177e-41 it should produce Should be the same: 1 =? 1 Thanks, Joe {{{ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::fusion; using namespace boost::phoenix; typedef float OutputType; // A general error function, measuring the difference between two output patterns. struct error_function3 { template struct result { typedef OutputType type; }; template OutputType operator()(Outputs1& outputs1, Outputs2& outputs2) const { using boost::phoenix::arg_names::_1; using boost::phoenix::arg_names::_2; using boost::fusion::fold; using boost::fusion::transform; float bad_result = fold(transform(outputs1, outputs2, (_1 - _2) * (_1 - _2)), 0, _1 + _2); float good_result = fold(as_vector(transform(outputs1, outputs2, (_1 - _2) * (_1 - _2))), 0, _1 + _2); std::cout << ""Should be the same: "" << good_result << "" =? "" << bad_result << std::endl; return good_result; } }; int main() { using boost::phoenix::arg_names::_1; using boost::phoenix::arg_names::_2; vector o1 = make_vector(1., 2.); vector o2 = make_vector(2., 3.); boost::phoenix::function const error; std::cout << error(_1, _2)(o1, o2) << std::endl; } }}} ",Bugs,closed,To Be Determined,fusion,Boost 1.47.0,Problem,wontfix,,joel@…