Skip to content

Instantly share code, notes, and snippets.

@rolandschulz
Created April 26, 2020 00:57
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 rolandschulz/645c615da8e1d1ce685ffec01f6ca85c to your computer and use it in GitHub Desktop.
Save rolandschulz/645c615da8e1d1ce685ffec01f6ca85c to your computer and use it in GitHub Desktop.
template<class T, T v>
struct integral_constant {
static constexpr T value = v;
using value_type = T;
using type = integral_constant; // using injected-class-name
constexpr operator value_type() const noexcept { return value; }
constexpr value_type operator()() const noexcept { return value; } //since c++14
};
using false_type = integral_constant<bool, false>;
using true_type = integral_constant<bool, true>;
template<class T, class U>
struct is_same : false_type {};
template<class T>
struct is_same<T, T> : true_type {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment