Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:03

0001 /*!
0002 @file
0003 Forward declares `boost::hana::count`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_FWD_COUNT_HPP
0011 #define BOOST_HANA_FWD_COUNT_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Return the number of elements in the structure that compare equal to
0019     //! a given value.
0020     //! @ingroup group-Foldable
0021     //!
0022     //! Given a Foldable structure `xs` and a value `value`, `count` returns
0023     //! an unsigned integral, or a Constant thereof, representing the number
0024     //! of elements of `xs` that compare equal to `value`. For this method to
0025     //! be well-defined, all the elements of the structure must be Comparable
0026     //! with the given value.
0027     //!
0028     //!
0029     //! @param xs
0030     //! The structure whose elements are counted.
0031     //!
0032     //! @param value
0033     //! A value compared with each element in the structure. Elements
0034     //! that compare equal to this value are counted, others are not.
0035     //!
0036     //!
0037     //! Example
0038     //! -------
0039     //! @include example/count.cpp
0040 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0041     constexpr auto count = [](auto&& xs, auto&& value) {
0042         return tag-dispatched;
0043     };
0044 #else
0045     template <typename T, typename = void>
0046     struct count_impl : count_impl<T, when<true>> { };
0047 
0048     struct count_t {
0049         template <typename Xs, typename Value>
0050         constexpr auto operator()(Xs&& xs, Value&& value) const;
0051     };
0052 
0053     BOOST_HANA_INLINE_VARIABLE constexpr count_t count{};
0054 #endif
0055 }} // end namespace boost::hana
0056 
0057 #endif // !BOOST_HANA_FWD_COUNT_HPP