error in array sorting using vectors in VC++6 while no error in VC++2012

I used this line code in VC++2012 to sort integrated row array called arrayCosts.
This code work in this version but d not work at VC++6 version.

1
2
3
4
vector< vector<float> > my_vector ;
for( const auto& row : arrayCosts ) my_vector.push_back( vector<float>( begin(row), end(row) ) ) ;
		sort( begin(my_vector), end(my_vector),
					[]( const vector<float>& a, const vector<float>& b ) { return a[1] < b[1] ; } ) ;	

The errors in VC++6 is as following.


1
2
3
4
5
6
7
8
9
10
11
12
e:\logistics\projects\10\10\source1.cpp(190) : error C2143: syntax error : missing ',' before ':'
e:\logistics\projects\10\10\source1.cpp(190) : error C2530: 'row' : references must be initialized
e:\logistics\projects\10\10\source1.cpp(190) : error C2059: syntax error : ':'
e:\logistics\projects\10\10\source1.cpp(191) : error C2065: 'begin' : undeclared identifier
e:\logistics\projects\10\10\source1.cpp(191) : error C2065: 'end' : undeclared identifier
e:\logistics\projects\10\10\source1.cpp(192) : error C2059: syntax error : '['
e:\logistics\projects\10\10\source1.cpp(192) : error C2143: syntax error : missing ')' before '{'
e:\logistics\projects\10\10\source1.cpp(192) : error C2143: syntax error : missing ';' before '{'
e:\logistics\projects\10\10\source1.cpp(192) : error C2065: 'a' : undeclared identifier
e:\logistics\projects\10\10\source1.cpp(192) : error C2109: subscript requires array or pointer type
e:\logistics\projects\10\10\source1.cpp(192) : error C2065: 'b' : undeclared identifier
e:\logistics\projects\10\10\source1.cpp(192) : error C2109: subscript requires array or pointer type


wHo knows how can change this part of code to be used in the VC++6?
Last edited on
VC++6, being released in 1998, has no C++11 support.
Topic archived. No new replies allowed.