Not an actual problem but rather a fashion crisis..
vector<array<unsigned int, 3>> tri;
tri.push_back(array<unsigned int, 3> {0, 0, 0});
gives me a syntax error. Is there any way to initialize a std array with values into a vector in one line?
The first rule of std::array is: when in doubt, add more braces. That's because you're actually initializing the raw array subobject of the std::array.
tri.push_back(array<unsigned int, 3> {{0, 0, 0}});
Both GCC and Clang accept this statement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With