Created
February 13, 2020 14:25
-
-
Save multun/15667bae21de1e76aa8e7d56cf0abf3d 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
#include <type_traits> | |
#include <iostream> | |
template<class T, class Enable = void> | |
struct A { | |
static void test() { | |
std::cout << "int" << std::endl; | |
} | |
}; | |
template<class T> | |
struct A<T, typename std::enable_if<std::is_floating_point<T>::value>::type> { | |
static void test() { | |
std::cout << "float" << std::endl; | |
} | |
}; | |
int main() | |
{ | |
A<int>::test(); | |
A<double>::test(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment