In C++ I want to return a struct by value which contains a variant with an array inside. The struct has no explicit constructors. Is this not possible?
In the following I get the compiler error (gcc):
"error: use of deleted function 'TestStruct2::TestStruct2(const TestStruct2&)'"
It works, if I define constructors. I don't want constructors here.
struct TestStruct2
{
std::variant<int[5], float[4]> t;
};
TestStruct2 test2()
{
TestStruct2 t;
return t;
}