Join STL vector

Asked 2 years ago, Updated 2 years ago, 85 views

Is there a way to combine multiple STL vectors into one?

c++ stl vecor concatenation

2022-09-22 22:33

1 Answers

Write std::vector::insert.

It can be written as follows:

template <class InputIterator>

void insert (iterator position, InputIterator first, InputIterator last);

If you have any questions

vector1.insert( vector1.end(), vector2.begin(), vector2.end() );

You can use it with


2022-09-22 22:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.