Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

added 43 characters in body
Source Link
Ali
  • 13
  • 1
  • 4

I am trying to find if all the elements of a vector y is equal to 1. The following code works fine in Visual Studio but with g++ in linux (g++ -std=c++0x) it gives me this error: expected primary-expression before ‘[’ token

bool x = all_of(y.begin(), y.end(), [](unsigned char j) {return j == 1;});

Any help would be appreciated.

My gcc version is: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

I am trying to find if all the elements of a vector y is equal to 1. The following code works fine in Visual Studio but with g++ in linux (g++ -std=c++0x) it gives me this error: expected primary-expression before ‘[’ token

bool x = all_of(y.begin(), y.end(), [](unsigned char j) {return j == 1;});

Any help would be appreciated.

My gcc version is: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

I am trying to find if all the elements of a vector y is equal to 1. The following code works fine in Visual Studio but with g++ in linux (g++ -std=c++0x) it gives me this error: expected primary-expression before ‘[’ token

bool x = all_of(y.begin(), y.end(), [](unsigned char j) {return j == 1;});

Any help would be appreciated.

My gcc version is: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

added 69 characters in body
Source Link
drescherjm
  • 11k
  • 5
  • 51
  • 72

I am trying to find if all the elements of a vector y is equal to 1. The following code works fine in Visual Studio but with g++ in linux (g++ -std=c++0x) it gives me this error: expected primary-expression before ‘[’ token

bool x = all_of(y.begin(), y.end(), [](unsigned char j) {return j == 1;});

Any help would be appreciated.

My gcc version is: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

I am trying to find if all the elements of a vector y is equal to 1. The following code works fine in Visual Studio but with g++ in linux (g++ -std=c++0x) it gives me this error: expected primary-expression before ‘[’ token

bool x = all_of(y.begin(), y.end(), [](unsigned char j) {return j == 1;});

Any help would be appreciated.

I am trying to find if all the elements of a vector y is equal to 1. The following code works fine in Visual Studio but with g++ in linux (g++ -std=c++0x) it gives me this error: expected primary-expression before ‘[’ token

bool x = all_of(y.begin(), y.end(), [](unsigned char j) {return j == 1;});

Any help would be appreciated.

My gcc version is: g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)

Source Link
Ali
  • 13
  • 1
  • 4

g++: expected primary-expression before ‘[’ token

I am trying to find if all the elements of a vector y is equal to 1. The following code works fine in Visual Studio but with g++ in linux (g++ -std=c++0x) it gives me this error: expected primary-expression before ‘[’ token

bool x = all_of(y.begin(), y.end(), [](unsigned char j) {return j == 1;});

Any help would be appreciated.

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /