There’s a fairly simple trick to do so, since the spec now guarantees vectors store their elements contiguously:
std::vector<double> v;
double* a = &v[0];
More Related Contents:
- Invalid operands to binary expression while implementing vector [closed]
- Difficulties on atributting a array to another [closed]
- Array of vectors
- Using arrays or std::vectors in C++, what’s the performance gap?
- Is std::vector so much slower than plain arrays?
- Correct way to work with vector of arrays
- std::vector versus std::array in C++
- Arrays vs Vectors: Introductory Similarities and Differences [closed]
- How to initialize std::vector from C-style array?
- Convert Mat to Array/Vector in OpenCV
- What is the difference between std::array and std::vector? When do you use one over other? [duplicate]
- How to initialize a vector in C++ [duplicate]
- Are vectors passed to functions by value or by reference in C++
- What is the simplest way to convert array to vector?
- C++ std::vector vs array in the real world
- splitting a string into an array in C++ without using vector
- Is it possible to initialize std::vector over already allocated memory?
- array vs vector vs list
- C++ N nested vectors at runtime
- C++ 2 dimensional array with variable size rows
- C++ STL: Array vs Vector: Raw element accessing performance
- How to cheaply assign C-style array to std::vector?
- vector vs. list in STL
- Looking for C++ STL-like vector class but using stack storage
- How to map the indexes of a matrix to a 1-dimensional array (C++)?
- How do I declare an array of objects whose class has no default constructor?
- Variable length arrays (VLA) in C and C++
- Converting between C++ std::vector and C array without copying
- Why don’t std::vector’s elements need a default constructor?
- How to erase & delete pointers to objects stored in a vector?