Skip to content

Instantly share code, notes, and snippets.

@njlr
Created May 31, 2017 15:04
Show Gist options
  • Save njlr/6bb7e04c4f6be7f2a813bf7a5d75f37f to your computer and use it in GitHub Desktop.
Save njlr/6bb7e04c4f6be7f2a813bf7a5d75f37f to your computer and use it in GitHub Desktop.
template<class T>
auto compute(T x) -> decltype( enable_if_t< supportsAPI(T{}), int>{}) {
return x.Method();
}
template<class T>
auto compute(T x) -> decltype( enable_if_t<!supportsAPI(T{}), int>{}) {
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment