Skip to content

Instantly share code, notes, and snippets.

@mattkretz
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattkretz/8ab41298abc1513a06b2 to your computer and use it in GitHub Desktop.
Save mattkretz/8ab41298abc1513a06b2 to your computer and use it in GitHub Desktop.
#include <type_traits>
#include <utility>
template<typename F, typename A>
std::true_type test(int bla);
template<typename F, typename A>
std::false_type test(...);
template<typename F, typename A>
struct testStruct
{
using type = decltype(test<F, A>(1));
};
template<typename F, typename A>
using tester = typename testStruct<F, A>::type;
template<typename X, typename Y>
typename
std::enable_if<
// now working!
tester<X, Y>::value,
Y>::type foo()
{
return 0;
}
int main()
{
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment