How to convert vector to array

后端 未结 10 1717
野的像风
野的像风 2020-11-22 09:20

How do I convert a std::vector to a double array[]?

10条回答
  •  佛祖请我去吃肉
    2020-11-22 09:39

    If you have a function, then you probably need this:foo(&array[0], array.size());. If you managed to get into a situation where you need an array then you need to refactor, vectors are basically extended arrays, you should always use them.

提交回复
热议问题