Adobe Source Libraries
1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
count.hpp
Go to the documentation of this file.
1
/*
2
Copyright 2013 Adobe
3
Distributed under the Boost Software License, Version 1.0.
4
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
*/
6
/**************************************************************************************************/
7
8
#ifndef ADOBE_ALGORITHM_COUNT_HPP
9
#define ADOBE_ALGORITHM_COUNT_HPP
10
11
#include <
adobe/config.hpp
>
12
13
#include <boost/range/begin.hpp>
14
#include <boost/range/difference_type.hpp>
15
#include <boost/range/end.hpp>
16
17
#include <algorithm>
18
#include <functional>
19
20
/**************************************************************************************************/
21
22
namespace
adobe
{
23
24
/**************************************************************************************************/
33
/**************************************************************************************************/
39
template
<
class
InputRange,
class
T>
40
inline
typename
boost::range_difference<InputRange>::type
count
(InputRange& range, T& value) {
41
return
std::count(boost::begin(range), boost::end(range), value);
42
}
43
49
template
<
class
InputRange,
class
T>
50
inline
typename
boost::range_difference<InputRange>::type
count
(
const
InputRange& range, T& value) {
51
return
std::count(boost::begin(range), boost::end(range), value);
52
}
53
59
template
<
class
InputIterator,
class
Predicate>
60
inline
typename
std::iterator_traits<InputIterator>::difference_type
61
count_if
(InputIterator first, InputIterator last, Predicate pred) {
62
return
std::count_if(first, last, std::bind(pred, std::placeholders::_1));
63
}
64
70
template
<
class
InputRange,
class
Predicate>
71
inline
typename
boost::range_difference<InputRange>::type
count_if
(InputRange& range,
72
Predicate pred) {
73
return
adobe::count_if
(boost::begin(range), boost::end(range), pred);
74
}
75
81
template
<
class
InputRange,
class
Predicate>
82
inline
typename
boost::range_difference<InputRange>::type
count_if
(
const
InputRange& range,
83
Predicate pred) {
84
return
adobe::count_if
(boost::begin(range), boost::end(range), pred);
85
}
86
87
/**************************************************************************************************/
88
89
}
// namespace adobe
90
91
/**************************************************************************************************/
92
93
#endif
94
95
/**************************************************************************************************/
config.hpp
adobe::count
boost::range_difference< InputRange >::type count(InputRange &range, T &value)
count implementation
Definition
count.hpp:40
adobe::count_if
std::iterator_traits< InputIterator >::difference_type count_if(InputIterator first, InputIterator last, Predicate pred)
count implementation
Definition
count.hpp:61
adobe
Definition
class_template.hpp:7
adobe
algorithm
count.hpp
Generated by
1.14.0