Skip to content

Instantly share code, notes, and snippets.

@rightfold
Last active August 29, 2015 14:07
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 rightfold/2905b9a38f6aa165474d to your computer and use it in GitHub Desktop.
Save rightfold/2905b9a38f6aa165474d to your computer and use it in GitHub Desktop.
namespace detail {
template<typename T>
bool constexpr contains(T) {
return false;
}
template<typename T, typename... U>
bool constexpr contains(T needle, T head, U... tail) {
return needle == head || contains(needle, tail...);
}
}
template<typename T, T Needle, T... Haystack>
struct contains : std::integral_constant<bool, detail::contains(Needle, Haystack...)> { };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment