mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-06 14:24:09 +00:00
porting sscrisk/CEL
This commit is contained in:
parent
ad60c8c530
commit
db20f64991
181 changed files with 2531 additions and 607 deletions
21
sprout/algorithm/count.hpp
Normal file
21
sprout/algorithm/count.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_ALGORITHM_COUNT_HPP
|
||||
#define SPROUT_ALGORITHM_COUNT_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
|
||||
namespace sprout {
|
||||
// Copyright (C) 2011 RiSK (sscrisk)
|
||||
|
||||
// 25.2.9 Count
|
||||
template<typename InputIterator, typename T>
|
||||
SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count(InputIterator first, InputIterator last, T const& value) {
|
||||
return first == last ? 0
|
||||
: (*first == value ? 1 : 0) + sprout::count(sprout::next(first), last, value)
|
||||
;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COUNT_HPP
|
Loading…
Add table
Add a link
Reference in a new issue