Jan 20, 2012 at 11:12am UTC
The Visual C++ 2010 debugger displays the elements of array a
char * a[] = {"Josefin", "Josefin","Josef","Julius"};
in the order of definition. Nevertheless when it displays elements of the following vector
vector<string> v(a, a + sizeof a / sizeof a[0]);
the last element of array a has moved to the first position! Could somebody explain please?
Jan 20, 2012 at 11:41am UTC
You mean to say, the debugger does that, not the program.
Because I compiled your code and no elements are swapped when printing the contents of vector v .
Jan 20, 2012 at 1:41pm UTC
Well at mine works also fine if that helps
Jan 20, 2012 at 3:16pm UTC
Yes - I was talking about my debugger.
Thanks!