New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
count_if.hpp in vendors/XIOS/current/extern/boost/include/boost/range/algorithm – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/range/algorithm/count_if.hpp @ 3428

Last change on this file since 3428 was 3428, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

File size: 1.6 KB
Line 
1//  Copyright Neil Groves 2009. Use, modification and
2//  distribution is subject to the Boost Software License, Version
3//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
4//  http://www.boost.org/LICENSE_1_0.txt)
5//
6//
7// For more information, see http://www.boost.org/libs/range/
8//
9#ifndef BOOST_RANGE_ALGORITHM_COUNT_IF_HPP_INCLUDED
10#define BOOST_RANGE_ALGORITHM_COUNT_IF_HPP_INCLUDED
11
12#include <boost/concept_check.hpp>
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15#include <boost/range/concepts.hpp>
16#include <boost/range/difference_type.hpp>
17#include <algorithm>
18
19namespace boost
20{
21    namespace range
22    {
23
24/// \brief template function count_if
25///
26/// range-based version of the count_if std algorithm
27///
28/// \pre SinglePassRange is a model of the SinglePassRangeConcept
29/// \pre UnaryPredicate is a model of the UnaryPredicateConcept
30template< class SinglePassRange, class UnaryPredicate >
31inline BOOST_DEDUCED_TYPENAME boost::range_difference<SinglePassRange>::type
32count_if(SinglePassRange& rng, UnaryPredicate pred)
33{
34    BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
35    return std::count_if(boost::begin(rng), boost::end(rng), pred);
36}
37
38/// \overload
39template< class SinglePassRange, class UnaryPredicate >
40inline BOOST_DEDUCED_TYPENAME boost::range_difference<const SinglePassRange>::type
41count_if(const SinglePassRange& rng, UnaryPredicate pred)
42{
43    BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
44    return std::count_if(boost::begin(rng), boost::end(rng), pred);
45}
46
47    } // namespace range
48    using range::count_if;
49} // namespace boost
50
51#endif // include guard
Note: See TracBrowser for help on using the repository browser.