Hi,
I want to prevent the sorting and preserve the original order in my container. below is the example.
How can I do it ?
string one = "6";
string two = "7";
string three = "2";
string four = "8";
veck.push_back(one);
veck.push_back(two);
veck.push_back(three);
veck.push_back(four);
veck.push_back("9");
veck.push_back("12");
veck.push_back("13");
veck.push_back("5");
I want to preserve the order of elements in my Vector which should be:-
6, 7, 2, 8, 9 ,12 ,13, 5
but when I try to insert into some other container using for loop it becomes sorted :
2, 5, 6, 7, 8, 9, 12, 13
e.g,
for(int i =0; i < veck.size(); i++){
newVec.push_back(veck[i]);
}
Howto preserve the order of elements in my original container and avoid sorting ?
Thanks