#include #include #include #include template struct common_type { using type = std::remove_reference_t() : std::declval())>; }; template struct common_type { using type = void; }; template struct common_type { using type = void; }; template <> struct common_type { using type = void; }; int main() { // is_same_v is true if both types in the template-argument list are the same // and false otherwise. assert((std::is_same_v< common_type::type, int>)); assert((std::is_same_v< common_type::type, int const>)); assert((std::is_same_v< common_type::type, double>)); assert((std::is_same_v< common_type::type, double>)); assert((std::is_same_v< common_type::type, std::string>)); assert((std::is_same_v< common_type::type, void>)); assert((std::is_same_v< common_type::type, void>)); assert((std::is_same_v< common_type::type, void>)); }