In c++14 I have the following type:
std::tuple<int[2], int>;
How can I properly initialize it? This
std::tuple<int[2], int> a {{2,2},3};
gives me this error:
/usr/include/c++/5/tuple:108:25: error: array used as initializer
While this:
std::tuple<std::array<int,2>, int> a {{2,2},3};
works, but I want to be able to work with standard C-style arrays
std::array<int,2>solves the problem and is a lot easier to work with. If your worried about speed or efficiency note thatstd::arrayis a zero cost abstraction and as long as you compile with optimizations on you get the same assembly code.std::tupleis not aggregate, andint[2]is not copyable :-/ ...