They aren’t the same though, are they? One is a copy, the other is a swap. Hence the function names.
My favourite is:
a = b;
Where a
and b
are vectors.
More Related Contents:
- Reorder vector using a vector of indices [duplicate]
- Erasing elements from a vector
- Why can’t I make a vector of references?
- Concatenating two std::vectors
- How do I sort a std::vector by the values of a different std::vector?
- When vectors are allocated, do they use memory on the heap or the stack?
- Is it safe to assume that STL vector storage is always contiguous?
- Efficient way of reading a file into an std::vector?
- How to initialize std::vector from C-style array?
- Where can I get a “useful” C++ binary search algorithm?
- std::transform() and toupper(), no matching function
- How to use std::sort with a vector of structures and compare function?
- std::vector, default construction, C++11 and breaking changes
- Initial capacity of vector in C++
- std::vector iterator invalidation
- STL vector and thread-safety
- How do you copy the contents of an array to a std::vector in C++ without looping?
- How to make elements of vector unique? (remove non adjacent duplicates)
- Why would I prefer using vector to deque
- std::vector removing elements which fulfill some conditions
- How can std::make_heap be implemented while making at most 3N comparisons?
- What is the right approach when using STL container for median calculation?
- Howto create combinations of several vectors without hardcoding loops in C++?
- Can std::vector emplace_back copy construct from an element of the vector itself?
- Why is a C++ Vector called a Vector? [closed]
- Why there is no std::copy_if algorithm?
- C++ STL: Array vs Vector: Raw element accessing performance
- How to get the address of the std::vector buffer start most elegantly?
- Checking if all elements of a vector are equal in C++
- How to cheaply assign C-style array to std::vector?