
2 Jul
2012
2 Jul
'12
6:51 p.m.
I'm trying to do a simple if/else statement using boost::phoenix and I seem to mis-understanding something. namespace bp = boost::phoenix; namespace bpa = bp::arg_names; boost::function< std::string () > test1 = bp::val("true"); boost::function< std::string (bool) > test2 = bp::if_(bpa::arg1) [ bp::val("true") ] .else_ [ bp::val("false") ]; The first one works, but the second one doesn't. I get an error about not being able to convert void to std::string: cannot convert parameter 1 from 'void' to 'const std::basic_string<_Elem,_Traits,_Ax> & What do I need to do in the second test to get it to compile? Can I tell if_ that its return type is not void? --- Aaron Wright