i need to to use c++ find_if() lambda expression, in my vc compiler it compiles without any errors, and i can't compile it in linux:debian:g++4.4 :
-CPP function:
istream_iterator<string> it = find_if(istream_iterator<string>(ss),
f,
[=](const string& str)
{return str == to_string(urlHash);});
-Error output:
-error: expected primary-expression before '[' token
-error: expected primary-expression before '=' token
-error: expected primary-expression before ']' token
-error: expected primary-expression before 'const'
question 1 : is this a version related problem of c++, despite using the -std=c++0x flag, nothing changes.
question 2 : i can't use -std=c++11 flag, despite that i installed the gcc 4.7 in my machine.
thanks;
if you guys interested in this i found a way to install gcc-4.7 by building it your self in every linux system link:
http://gcc.gnu.org/install/
Yes. Lambdas are not supported in GCC 4.4. You will need to upgrade to or install version 4.5 or higher. See here for more details.
That is not a question.