Z
zhouchengly
when I run the following code in vs2005:
int A[] = {7, 2, 6, 11, 9, 3, 12, 10, 8, 4, 1, 5};
const int N = sizeof(A) / sizeof(int);
nth_element(A, A +1, A + N);
copy(A, A + N, ostream_iterator<int>(cout, " "));
I got output: 1,2,3,4,5,6,7,8,9,10,11,12, obviously, it's all sorted.
but sgi stl said the result should be "5 2 6 1 4 3 7 8 9 10 11 12".
http://www.sgi.com/tech/stl/nth_element.html
does it mean that vs2005 not compatible with stl in this function?
int A[] = {7, 2, 6, 11, 9, 3, 12, 10, 8, 4, 1, 5};
const int N = sizeof(A) / sizeof(int);
nth_element(A, A +1, A + N);
copy(A, A + N, ostream_iterator<int>(cout, " "));
I got output: 1,2,3,4,5,6,7,8,9,10,11,12, obviously, it's all sorted.
but sgi stl said the result should be "5 2 6 1 4 3 7 8 9 10 11 12".
http://www.sgi.com/tech/stl/nth_element.html
does it mean that vs2005 not compatible with stl in this function?