#include <iostream>
#include <type_traits>
#include <string>
template <class T, class Enable = void>
class Foo {};
template<class T>
class Foo<T, typename std::enable_if<std::is_integral<T>::value>::type> {
public:
std::string wow() {
return "WOW";
}
};
template<class T>
class Foo<T, typename std::enable_if<std::is_class<T>::value>::type> {
public:
std::string wow() {
return "Meo";
}
};
class Bar {};
int main() {
std::cout << Foo<int>().wow() << '\n';
std::cout << Foo<long>().wow() << '\n';
std::cout << Foo<Bar>().wow();
return 0;
}
WOW
WOW
Meo
mt19937 gen(time(0));
uniform_int_distribution<int> uid(1, 9);
int f(int n) {
if (n >= 3)
return n + 1;
else
return n;
}
int i = f(uid(gen));