Distinguish between types using SFINAE and void_t
问题 I faced some situation where I have to write two functions, one of them should be invoked with primitive types and std::string . The other one should be called with other types. So far I ended with working solution: template <typename...> struct Void_t_helper { using type = void; }; template <typename... Ts> using Void_t = typename Void_t_helper<Ts...>::type; template <typename T, typename = void> struct Is_string : std::false_type {}; template <typename T> struct Is_string<T, Void_t<decltype