Change mp_and and mp_or to match std::conjuction and std::disjunction

This commit is contained in:
Peter Dimov
2017-03-16 17:49:57 +02:00
parent 7bbdaacda1
commit e4f7488652
3 changed files with 50 additions and 40 deletions

View File

@@ -1,7 +1,7 @@
#ifndef BOOST_MP11_FUNCTION_HPP_INCLUDED
#define BOOST_MP11_FUNCTION_HPP_INCLUDED
// Copyright 2015, 2016 Peter Dimov.
// Copyright 2015-2017 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
@@ -39,9 +39,14 @@ template<> struct mp_and_impl<>
using type = mp_true;
};
template<class T> struct mp_and_impl<T>
{
using type = T;
};
template<class T1, class... T> struct mp_and_impl<T1, T...>
{
using type = mp_eval_if< mp_not<T1>, mp_false, mp_and, T... >;
using type = mp_eval_if< mp_not<T1>, T1, mp_and, T... >;
};
} // namespace detail
@@ -67,9 +72,14 @@ template<> struct mp_or_impl<>
using type = mp_false;
};
template<class T> struct mp_or_impl<T>
{
using type = T;
};
template<class T1, class... T> struct mp_or_impl<T1, T...>
{
using type = mp_eval_if< T1, mp_true, mp_or, T... >;
using type = mp_eval_if< T1, T1, mp_or, T... >;
};
} // namespace detail