
Well I was willing to do 2 things * to use call 'break' to get out of the std::for_each * to use return to exit out of the class function having this code. For the 'break' command now I found other means ( shame on me: I can't use break in a std::for_each like if ..typed without too much thinking ..sorry ) but still I don't know how to fix the call to 'return'. If I put a call to 'return' in lambda expression inside std::for_each to exit the function I have the same error. On Thu, Jul 22, 2010 at 1:45 PM, OvermindDL1 <overminddl1@gmail.com> wrote:
On Thu, Jul 22, 2010 at 5:36 AM, Conoscenza Silente <abruzzoforteegentile@gmail.com> wrote:
Hi All I created a lambda expression inside my std::for_each call. Inside it there is code like this one, but I have building error telling me that
error: expected primary-expression before ‘break’ error: expected `]' before ‘break’
Do you know what it is and how to fix it? The same applies to return statement Thanks AFG
namespace bl = boost::lambda; int a, b; bl::var_type< int >::type a_( bl::var( a ) ); bl::var_type< int >::type b_( bl::var( b ) );
std::for_each( v.begin(), v.end(), ( if_( a_ > _b_ ) [ std::cout << _1, break ] ));
'break' is not a lazy command, hence it will not work there. What are you even trying to do anyway? _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users