Assuming I do not want to write a concept (or my compiler does not support them) and there is no matching type trait is there C++20 non void_t way to check if I can construct A with arguments B and C?
Note: this is a toy example, real question is is void_t still the best way beside concepts to check if something compiles in C++20.
template <typename A, typename B, typename C,typename = void>
struct my_is_constructible : std::false_type {};
template <typename A, typename B, typename C>
struct my_is_constructible <A, B,C,
std::void_t<decltype(A(std::declval<B>(), std::declval<C>()))>>
: std::true_type {};
You can use the detected idiom, which is an abstraction over
void_t. This is pretty much the closest you can get from concepts without them:It can then be used like this: