Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use both std::vector and std::array at the same time?

I am using something like this:

std::vector<std::array<double, 3>> myarray;

but when I want to add new elements into the array, I try to use

myarray.push_back({0, 0 ,0});

It doesn't compile with VS2012.

So how can I use std::array as an element of std::vector?

Thank you.

like image 299
user3692418 Avatar asked Aug 30 '26 02:08

user3692418


1 Answers

You're out of luck I'm afraid: VS2012 does not support brace initialisation.

Note that your code is valid C++11.

like image 176
Bathsheba Avatar answered Aug 31 '26 15:08

Bathsheba



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!