Created
November 14, 2018 21:13
-
-
Save NotAPenguin0/a1ddcfd237d8e9e6e7635b3b574cfe28 to your computer and use it in GitHub Desktop.
metafunc utility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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