Skip to content

Instantly share code, notes, and snippets.

@NotAPenguin0
Created November 14, 2018 21:13
Show Gist options
  • Select an option

  • Save NotAPenguin0/a1ddcfd237d8e9e6e7635b3b574cfe28 to your computer and use it in GitHub Desktop.

Select an option

Save NotAPenguin0/a1ddcfd237d8e9e6e7635b3b574cfe28 to your computer and use it in GitHub Desktop.
metafunc utility
template<template<typename> typename F>
struct bool_metafunc
{
template<typename T>
struct negate
{
static constexpr bool value = !(F<T>::value);
};
template<template<typename> typename Other>
struct binary_op
{
template<typename T>
struct logic_or
{
static constexpr bool value = F<T>::value || Other<T>::value;
};
template<typename T>
struct logic_and
{
static constexpr bool value = F<T>::value && Other<T>::value;
};
};
};
template<typename T>
using integr_or_float = typename mvg::bool_metafunc<std::is_integral>::binary_op<std::is_floating_point>::logic_or<T>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment