snippetcppCritical
How to convert vector to array
Viewed 0 times
arrayconverthowvector
Problem
How do I convert a
std::vector to a double array[]?Solution
There's a fairly simple trick to do so, since the spec now guarantees vectors store their elements contiguously:
std::vector v;
double* a = &v[0];Code Snippets
std::vector<double> v;
double* a = &v[0];Context
Stack Overflow Q#2923272, score: 693
Revisions (0)
No revisions yet.