I need the best way to put something to the end without re listing for vector container, but not replacing
when I have alot elements my function not that good
this is mine:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include<vector>
#include<stdio.h>
template<typename unkwn>
void vtot(std::vector<unkwn>&l,size_t i){
unkwn item=l[i];
l.erase(l.begin()+i);
l.push_back(item);
};
int main(int argc,char**args){
std::vector<const char*>hue;
hue.push_back("1");
hue.push_back("2");
hue.push_back("3");
hue.push_back("4");
vtot(hue,0);
puts(hue[0]);
puts(hue[1]);
puts(hue[2]);
puts(hue[3]);
return 0;
};
|
Last edited on
not good because nothing really changed
my way is not good because my way will lagg when alot elements
Last edited on
I don't write own container but if you know another way I'd listen
thanks for deque that much faster than vector