If all of the members of std::tuple
are of standard layout types, is that std::tuple
itself standard layout? The presence of a user-defined copy-constr
The "list" approach can be used to get standard layout tuple
(the following example has some inaccuracies but demonstrates the idea):
template
struct tuple;
template
struct tuple {
T value;
tuple next;
};
template <>
struct tuple<> {};
namespace details {
template
struct get_impl {
template
constexpr static auto process(const tuple& t) {
return get_impl::process(t.next);
}
};
template <>
struct get_impl<0> {
template
constexpr static auto process(const tuple& t) {
return t.value;
}
};
}
template
constexpr auto get(const tuple& t) {
return details::get_impl::process(t);
}
template
constexpr auto make_tuple(Args&&... args) {
return tuple{std::forward(args)...};
}