a.insert(a.end(), b.begin(), b.end());
or
a.insert(std::end(a), std::begin(b), std::end(b));
The second variant is a more generically applicable solution, as b
could also be an array. However, it requires C++11. If you want to work with user-defined types, use ADL:
using std::begin, std::end;
a.insert(end(a), begin(b), end(b));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…