Daily bit(e) of C++ | customizing structured binding
Daily bit(e) of C++ #481, Implementing custom structured binding for non-aggregate user types.
Structured binding is available for tuple-like and aggregate types.
However, to make a user-defined type tuple-like, we only need to specialize the std::tuple_size and std::tuple_element templates and overload the get function.
This means we can enable structured bindings for user-defined types while keeping the members private or for types that contain virtual methods.
I don't think that the `::get`overload for `has_layout` is needed -- the compiler will try to use the member function`.get`first. I also don't believe it's correct if `T` is a reference type, and also for the `&T::template get<idx>` construct the compiler wouldn't be able to deduce the type parameter.