The returned lambda type can be inferred, but only if there is only one statement, and this statement is a return that returns an expression (for example, the list of initializers is not an expression). If you have a multi-task lambda, then the return type is considered invalid.
Therefore you should do this:
remove_if(rawLines.begin(), rawLines.end(), [&expression, &start, &end, &what, &flags](const string& line) -> bool { start = line.begin(); end = line.end(); bool temp = boost::regex_search(start, end, what, expression, flags); return temp; })
But actually your second expression is much readable.
Nicol Bolas Mar 08 '12 at 16:18 2012-03-08 16:18
source share