Created
June 16, 2017 13:53
-
-
Save 2bbb/cd76c6c6490e506490ee4e61bfd60e8d to your computer and use it in GitHub Desktop.
polyfill
This file contains 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
namespace bbb { | |
template <typename type> | |
struct is_null_pointer : std::false_type {}; | |
template <typename type> | |
using is_null_pointer_t : get_type<is_null_pointer<type>>; | |
template <> | |
struct is_null_pointer<std::nullptr_t> : std::true_type {}; | |
template <typename ...> | |
using void_t = void; | |
template <bool b> | |
using bool_constant = std::_integral_constant<bool, b>; | |
template <typename cond> | |
struct negation : bool_constant<!bool(cond::value)> {}; | |
template <typename ... conditions> | |
struct conjunction : std::true_type {}; | |
template <typename cond> | |
struct conjunction<cond> : cond {}; | |
template <typename cond, typename ... conditions> | |
struct conjunction<cond, conditions ...> : condtional_t<bool(cond::value), conjunction<conditions ...>, cond> {}; | |
template <typename ... conditions> | |
struct disjunction : std::false_type {}; | |
template <typename cond> | |
struct disjunction<cond> : cond {}; | |
template <typename cond, typename ... conditions> | |
struct disjunction<cond, conditions ...> : condtional_t<bool(cond::value), cond, disjunction<conditions ...>> {}; | |
template <typename cond, typename type = void> | |
struct meta_enable_if : enable_if<cond::value, type> {}; | |
template <typename cond, typename type = void> | |
using meta_enable_if_t : enable_if_t<cond::value, type> {}; | |
template <typename cond, typename true_t, typename false_t> | |
struct meta_conditional : conditional<cond::value, true_t, false_t> {}; | |
template <typename cond, typename true_t, typename false_t> | |
struct meta_conditional_t : conditional_t<cond::value, true_t, false_t> {}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment