0

Is it possible to append to an std::vector another std::vector by moving the second into the first? If so, how?

I'm only aware of this syntax to perform the append operation:

vec_a.insert( vec_a.end(), vec_b.begin( ), vec_b.end( ) );
nyarlathotep108
  • 5,275
  • 2
  • 26
  • 64
  • What do you want to achieve? Omit a copy of the appended elements? That's not possible as each vector uses its own internal, continuous storage on the heap. – ypnos Feb 24 '16 at 16:00
  • 4
    Is this what you mean? http://stackoverflow.com/questions/10720122/is-there-a-standard-way-of-moving-a-range-into-a-vector – Steve Jessop Feb 24 '16 at 16:01
  • @ypnos sometimes objects are movable but not copiable – user3528438 Feb 24 '16 at 16:01

0 Answers0