3 Forward declares `boost::hana::count_if`.
5 @copyright Louis Dionne 2013-2017
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_COUNT_IF_HPP
11 #define BOOST_HANA_FWD_COUNT_IF_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Return the number of elements in the structure for which the
19 //! `predicate` is satisfied.
20 //! @ingroup group-Foldable
22 //! Specifically, returns an object of an unsigned integral type, or
23 //! a `Constant` holding such an object, which represents the number
24 //! of elements in the structure satisfying the given `predicate`.
28 //! The structure whose elements are counted.
31 //! A function called as `predicate(x)`, where `x` is an element of the
32 //! structure, and returning a `Logical` representing whether `x` should
38 //! @include example/count_if.cpp
39 #ifdef BOOST_HANA_DOXYGEN_INVOKED
40 constexpr auto count_if = [](auto&& xs, auto&& predicate) {
41 return tag-dispatched;
44 template <typename T, typename = void>
45 struct count_if_impl : count_if_impl<T, when<true>> { };
48 template <typename Xs, typename Pred>
49 constexpr auto operator()(Xs&& xs, Pred&& pred) const;
52 constexpr count_if_t count_if{};
54 BOOST_HANA_NAMESPACE_END
56 #endif // !BOOST_HANA_FWD_COUNT_IF_HPP