Providing Structured Binding Interface for Custom Class
To work with custom classes, we need three things: 1. std::tuple_size 2. get<N> 3. std::tuple_element
We'll cover the following...
We'll cover the following...
You can provide Structured Binding support for a custom class.
To do that you have to define get<N>, std::tuple_size and std::tuple_element specialisations for your type.
For example, if you have a class with three members, but you’d like to expose only its public interface:
The interface for Structured Bindings:
tuple_size specifies how many fields are available, ...