source: vendor/nemo/current/NEMOGCM/EXTERNAL/XIOS/extern/boost/include/boost/range/algorithm/count.hpp @ 44

Last change on this file since 44 was 44, checked in by cholod, 12 years ago

Load NEMO_TMP into vendor/nemo/current.

File size: 1.5 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_HPP_INCLUDED
10#define BOOST_RANGE_ALGORITHM_COUNT_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
25///
26/// range-based version of the count std algorithm
27///
28/// \pre SinglePassRange is a model of the SinglePassRangeConcept
29template< class SinglePassRange, class Value >
30inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type
31count(SinglePassRange& rng, const Value& val)
32{
33    BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
34    return std::count(boost::begin(rng), boost::end(rng), val);
35}
36
37/// \overload
38template< class SinglePassRange, class Value >
39inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange const>::type
40count(const SinglePassRange& rng, const Value& val)
41{
42    BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
43    return std::count(boost::begin(rng), boost::end(rng), val);
44}
45
46    } // namespace range
47    using range::count;
48} // namespace boost
49
50#endif // include guard
Note: See TracBrowser for help on using the repository browser.