Last active
July 12, 2017 20:58
-
-
Save stryku/8216cf23bfaa67beaffadff0f1dd4923 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //big credits to this guy, for a hints: https://stackoverflow.com/a/16824239/4175394 | |
| template <typename Type> | |
| struct HasToString { | |
| private: | |
| template<typename T> | |
| static constexpr auto check(T*) -> typename std::is_same< | |
| decltype(std::declval<T>().toString()), | |
| std::string | |
| >::type; | |
| template<typename> | |
| static constexpr std::false_type check(...); | |
| using type = decltype(check<Type>(nullptr)); | |
| public: | |
| static constexpr bool value = type::value; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment