I want to check at compile-time if user literal _name is defined for type Ret and argument Arg. While I have half-solution, it require
With is_detected functions family, you may just do
template
using has_literal_x_type = decltype(operator"" _x(std::declval()));
template
using has_literal_x = std::is_same>;
And test it with
static_assert(!has_literal_x::value, "unexpected");
static_assert(!has_literal_x::value, "unexpected");
static_assert(!has_literal_x::value, "unexpected");
static_assert(!has_literal_x::value, "unexpected");
static_assert(!has_literal_x::value, "unexpected");
Demo