Skip to content

Instantly share code, notes, and snippets.

@ScatteredRay
Created June 18, 2017 08:35
Show Gist options
  • Save ScatteredRay/327cdf4d32ee6348fcb71ef622a4e324 to your computer and use it in GitHub Desktop.
Save ScatteredRay/327cdf4d32ee6348fcb71ef622a4e324 to your computer and use it in GitHub Desktop.
Template partial specialization.
template <typename T, typename = void>
struct Foo;
// A
template <typename T>
struct Foo<unique_ptr<T>, typename std::enable_if<std::is_class<T>::value>::type> {...};
// B
template <typename T>
struct Foo<T, typename std::enable_if<std::is_class<T>::value>::type> {...};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment