2
0
mirror of https://github.com/boostorg/mp11.git synced 2026-02-22 03:22:29 +00:00

Make the E parameter of mp_if optional

This commit is contained in:
Peter Dimov
2017-05-18 14:59:46 +03:00
parent e67e6ce89d
commit 37bbb15375
5 changed files with 54 additions and 20 deletions

View File

@@ -33,9 +33,11 @@ template<class... T> struct mp_inherit: T... {};
namespace detail
{
template<bool C, class T, class E> struct mp_if_c_impl;
template<bool C, class T, class... E> struct mp_if_c_impl
{
};
template<class T, class E> struct mp_if_c_impl<true, T, E>
template<class T, class... E> struct mp_if_c_impl<true, T, E...>
{
using type = T;
};
@@ -47,8 +49,8 @@ template<class T, class E> struct mp_if_c_impl<false, T, E>
} // namespace detail
template<bool C, class T, class E> using mp_if_c = typename detail::mp_if_c_impl<C, T, E>::type;
template<class C, class T, class E> using mp_if = typename detail::mp_if_c_impl<static_cast<bool>(C::value), T, E>::type;
template<bool C, class T, class... E> using mp_if_c = typename detail::mp_if_c_impl<C, T, E...>::type;
template<class C, class T, class... E> using mp_if = typename detail::mp_if_c_impl<static_cast<bool>(C::value), T, E...>::type;
// mp_eval_if, mp_eval_if_c
namespace detail