How to check if type instance can be used inside structured binding declaration?

91 Views Asked by At

How to write e.g. is_structured_bindable_2<T> in C++17? It should only be true_type if auto [f1, f2] = x; compiles where x is an instance of T;

template<typename T, typename = void>
struct is_structured_bindable_2<T> : std::false_type {};

template<typename T>
struct is_structured_bindable_2<T, ???>
    : std::true_type {};

I couldn't find how to check if a statement (not an expression) compiles in SFINAE in C++17. Any help is greatly appreciated.

0

There are 0 best solutions below