|
@@ -34,13 +34,21 @@ namespace meta { |
|
|
//! Tool to enable a partial specialization only if a boolean condition is true.
|
|
|
//! Tool to enable a partial specialization only if a boolean condition is true.
|
|
|
//! @{
|
|
|
//! @{
|
|
|
namespace detail {
|
|
|
namespace detail {
|
|
|
template <bool If>
|
|
|
|
|
|
struct when_ { };
|
|
|
|
|
|
template <> struct when_<true> { using type = void; };
|
|
|
|
|
|
|
|
|
template <typename... T>
|
|
|
|
|
|
struct dev_null { using type = dev_null; }; //< Same as typelist
|
|
|
|
|
|
|
|
|
|
|
|
template <bool If> struct when_ { };
|
|
|
|
|
|
template <> struct when_<true> { using type = void; };
|
|
|
}
|
|
|
}
|
|
|
//! Well formed only if \p If is true
|
|
|
//! Well formed only if \p If is true
|
|
|
template <bool If>
|
|
|
template <bool If>
|
|
|
using when = type_<detail::when_<If>>;
|
|
|
using when = type_<detail::when_<If>>;
|
|
|
|
|
|
|
|
|
|
|
|
//! Well formed only if all of \p Ifs are \c true
|
|
|
|
|
|
template <bool ...Ifs>
|
|
|
|
|
|
using when_all = detail::dev_null<
|
|
|
|
|
|
when<Ifs>...
|
|
|
|
|
|
>;
|
|
|
//! @}
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
//! select _Tp if \p If is true, else SFINAE
|
|
|
//! select _Tp if \p If is true, else SFINAE
|
|
@@ -59,11 +67,15 @@ namespace meta { |
|
|
|
|
|
|
|
|
//! Publicly recognized alias template for enable_if
|
|
|
//! Publicly recognized alias template for enable_if
|
|
|
template<bool If, typename _Tp = void>
|
|
|
template<bool If, typename _Tp = void>
|
|
|
using enable_if_t = type_<enable_if<If, _Tp>>;
|
|
|
|
|
|
|
|
|
using enable_if_t = type_<
|
|
|
|
|
|
enable_if<If, _Tp>
|
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
//! Uniform alias template for use_if
|
|
|
//! Uniform alias template for use_if
|
|
|
template<bool If, typename _Tp = void>
|
|
|
template<bool If, typename _Tp = void>
|
|
|
using use_if_t = type_<enable_if<If, _Tp>>;
|
|
|
|
|
|
|
|
|
using use_if_t = type_<
|
|
|
|
|
|
enable_if<If, _Tp>
|
|
|
|
|
|
>;
|
|
|
//! @}
|
|
|
//! @}
|
|
|
|
|
|
|
|
|
}}
|
|
|
}}
|
|
|