forked from boostorg/mp11
		
	Add mp_all, mp_and, mp_any, mp_or; move mp_not to integral.hpp.
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
#ifndef BOOST_MP11_ALGORITHM_HPP_INCLUDED
 | 
			
		||||
#define BOOST_MP11_ALGORITHM_HPP_INCLUDED
 | 
			
		||||
 | 
			
		||||
//  Copyright 2015 Peter Dimov.
 | 
			
		||||
//  Copyright 2015, 2016 Peter Dimov.
 | 
			
		||||
//
 | 
			
		||||
//  Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
//
 | 
			
		||||
@@ -12,6 +12,7 @@
 | 
			
		||||
#include <boost/mp11/set.hpp>
 | 
			
		||||
#include <boost/mp11/integral.hpp>
 | 
			
		||||
#include <boost/mp11/utility.hpp>
 | 
			
		||||
#include <boost/mp11/detail/mp_count.hpp>
 | 
			
		||||
#include <boost/mp11/detail/mp_plus.hpp>
 | 
			
		||||
#include <boost/mp11/detail/mp_map_find.hpp>
 | 
			
		||||
#include <boost/mp11/detail/config.hpp>
 | 
			
		||||
@@ -95,77 +96,6 @@ template<template<class...> class L, class... T, class V> struct mp_fill_impl<L<
 | 
			
		||||
 | 
			
		||||
template<class L, class V> using mp_fill = typename detail::mp_fill_impl<L, V>::type;
 | 
			
		||||
 | 
			
		||||
// mp_count<L, V>
 | 
			
		||||
namespace detail
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
template<class L, class V> struct mp_count_impl;
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_MP11_NO_CONSTEXPR )
 | 
			
		||||
 | 
			
		||||
constexpr std::size_t cx_plus()
 | 
			
		||||
{
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class T1, class... T> constexpr std::size_t cx_plus(T1 t1, T... t)
 | 
			
		||||
{
 | 
			
		||||
    return t1 + cx_plus(t...);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<template<class...> class L, class... T, class V> struct mp_count_impl<L<T...>, V>
 | 
			
		||||
{
 | 
			
		||||
    using type = mp_size_t<cx_plus(std::is_same<T, V>::value...)>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
template<template<class...> class L, class... T, class V> struct mp_count_impl<L<T...>, V>
 | 
			
		||||
{
 | 
			
		||||
    using type = mp_size_t<mp_plus<std::is_same<T, V>...>::value>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
} // namespace detail
 | 
			
		||||
 | 
			
		||||
template<class L, class V> using mp_count = typename detail::mp_count_impl<L, V>::type;
 | 
			
		||||
 | 
			
		||||
// mp_count_if<L, P>
 | 
			
		||||
namespace detail
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
template<class L, template<class...> class P> struct mp_count_if_impl;
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_MP11_NO_CONSTEXPR )
 | 
			
		||||
 | 
			
		||||
template<template<class...> class L, class... T, template<class...> class P> struct mp_count_if_impl<L<T...>, P>
 | 
			
		||||
{
 | 
			
		||||
    using type = mp_size_t<cx_plus(mp_to_bool<P<T>>::value...)>;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
template<template<class...> class L, class... T, template<class...> class P> struct mp_count_if_impl<L<T...>, P>
 | 
			
		||||
{
 | 
			
		||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1900 )
 | 
			
		||||
 | 
			
		||||
    template<class T> struct _f { using type = mp_to_bool<P<T>>; };
 | 
			
		||||
    using type = mp_size_t<mp_plus<typename _f<T>::type...>::value>;
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    using type = mp_size_t<mp_plus<mp_to_bool<P<T>>...>::value>;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
} // namespace detail
 | 
			
		||||
 | 
			
		||||
template<class L, template<class...> class P> using mp_count_if = typename detail::mp_count_if_impl<L, P>::type;
 | 
			
		||||
 | 
			
		||||
// mp_contains<L, V>
 | 
			
		||||
template<class L, class V> using mp_contains = mp_to_bool<mp_count<L, V>>;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user