Use std::vector
‘s range constructor:
std::vector<int> intVec;
std::vector<double> doubleVec(intVec.begin(), intVec.end());
More Related Contents:
- Thou shalt not inherit from std::vector
- What’s the most efficient way to erase duplicates and sort a vector?
- std::vector::resize() vs. std::vector::reserve()
- Is std::vector so much slower than plain arrays?
- vector vs. list in STL
- How do I sort a std::vector by the values of a different std::vector?
- How do I erase an element from std::vector by index?
- Is it safe to assume that STL vector storage is always contiguous?
- How to get std::vector pointer to the raw data?
- Efficient way of reading a file into an std::vector?
- C++ Erase vector element by value rather than by position? [duplicate]
- Looking for C++ STL-like vector class but using stack storage
- How to initialize std::vector from C-style array?
- Appending a vector to a vector [duplicate]
- Sorting a vector in descending order
- Why is it OK to return a ‘vector’ from a function?
- Is the use of std::vector objects in C++ acceptable, or should I use an alternative?
- STL vector and thread-safety
- Sorting a std::vector by the string?
- How do you copy the contents of an array to a std::vector in C++ without looping?
- Cleaning up an STL list/vector of pointers
- Why would I prefer using vector to deque
- What happens if you increment an iterator that is equal to the end iterator of an STL container
- std::vector reserve() and push_back() is faster than resize() and array index, why?
- Vector Iterators Incompatible
- Why the libc++ std::vector internally keeps three pointers instead of one pointer and two sizes?
- Why is a C++ Vector called a Vector? [closed]
- Is it more efficient to copy a vector by reserving and copying, or by creating and swapping? [duplicate]
- STL vectors with uninitialized storage?
- “Right” way to deallocate an std::vector object