On 21 July 2017 at 17:04, Michał Dominiak <
gri...@griwes.info> wrote:
> There is currently a customization point (or, a set of customization
> points...) for this feature in the language: std::tuple_size,
> std::tuple_element, and get(). They aren't pretty to use, but I'm not
> convinced your proposed way to customize the behavior is really better.
Right, however, in general, types convertible to types that can be
structured-bound aren't supported by structured
bindings. If you have
struct X : tuple<int, int> {};
you can't do structured bindings on it.
On the other hand, allowing conversions gets tricky; what if I have
data members in X? Then it 'obviously' shouldn't
do structured bindings via a conversion to tuple, so what we would get
via the conversions is not necessarily better.
It would certainly make the rules more complex.
>
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdSxx8TBEC%2BbdPr%2BMnZPBYvZKrFK350zOnwE7U7Ug0BmmQ%40mail.gmail.com.