I have struct which contains array of inner struct. I want to use method emplace_back()
of vector<my_struct>
. But I cannot figure how could I initialize this struct correctly:
struct my_struct
{
struct
{
float x, y, z;
} point[3];
};
std::vector<my_struct> v;
v.emplace_back(
{0, 0, 0},
{0, 0, 0},
{0, 0, 0}
);
This gives compilation error error: no matching function for call to ‘std::vector<main()::my_struct>::emplace_back(<brace-enclosed initializer list>, <brace-enclosed initializer list>, <brace-enclosed initializer list>)
Is it possible to emplace_back this struct (I'm using C++17)? Should I write custom constructor?