#ifndef BOOST_MP11_DETAIL_MP_COUNT_HPP_INCLUDED #define BOOST_MP11_DETAIL_MP_COUNT_HPP_INCLUDED // Copyright 2015, 2016 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt #include #include #include #include namespace boost { // mp_count namespace detail { template struct mp_count_impl; #if !defined( BOOST_MP11_NO_CONSTEXPR ) constexpr std::size_t cx_plus() { return 0; } template constexpr std::size_t cx_plus(T1 t1, T... t) { return t1 + cx_plus(t...); } template class L, class... T, class V> struct mp_count_impl, V> { using type = mp_size_t::value...)>; }; #else template class L, class... T, class V> struct mp_count_impl, V> { using type = mp_size_t...>::value>; }; #endif } // namespace detail template using mp_count = typename detail::mp_count_impl::type; // mp_count_if namespace detail { template class P> struct mp_count_if_impl; #if !defined( BOOST_MP11_NO_CONSTEXPR ) template class L, class... T, template class P> struct mp_count_if_impl, P> { using type = mp_size_t>::value...)>; }; #else template class L, class... T, template class P> struct mp_count_if_impl, P> { #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1900 ) template struct _f { using type = mp_to_bool>; }; using type = mp_size_t::type...>::value>; #else using type = mp_size_t>...>::value>; #endif }; #endif } // namespace detail template class P> using mp_count_if = typename detail::mp_count_if_impl::type; } // namespace boost #endif // #ifndef BOOST_MP11_DETAIL_MP_COUNT_HPP_INCLUDED