how to add element to beginning of vector c++ code example
Example: c++ how to add something at the start of a vector
#include <vector>
int main() {
std::vector<int> v{ 1, 2, 3, 4, 5 };
v.insert(v.begin(), 6);
}
#include <vector>
int main() {
std::vector<int> v{ 1, 2, 3, 4, 5 };
v.insert(v.begin(), 6);
}