Answers for "c++ vector place in front"

C++
0

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);
}
Posted by: Guest on June-19-2020

Browse Popular Code Answers by Language