mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-04 14:14:09 +00:00
porting sscrisk/CEL
This commit is contained in:
parent
ad60c8c530
commit
db20f64991
181 changed files with 2531 additions and 607 deletions
28
sprout/algorithm/is_partitioned.hpp
Normal file
28
sprout/algorithm/is_partitioned.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef SPROUT_ALGORITHM_IS_PARTITIONED_HPP
|
||||
#define SPROUT_ALGORITHM_IS_PARTITIONED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
|
||||
namespace sprout {
|
||||
// Copyright (C) 2011 RiSK (sscrisk)
|
||||
|
||||
namespace detail {
|
||||
template<typename InputIterator, typename Predicate>
|
||||
SPROUT_CONSTEXPR bool is_partitioned_impl(InputIterator first, InputIterator last, Predicate pred, bool cond = true) {
|
||||
return first == last ? true
|
||||
: cond ? sprout::detail::is_partitioned_impl(sprout::next(first), last, pred, pred(*first))
|
||||
: pred(*first) ? false
|
||||
: sprout::detail::is_partitioned_impl(sprout::next(first), last, pred, false)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
// 25.3.13 Partitions
|
||||
template<typename InputIterator, typename Predicate>
|
||||
SPROUT_CONSTEXPR bool is_partitioned(InputIterator first, InputIterator last, Predicate pred) {
|
||||
return sprout::detail::is_partitioned_impl(first, last, pred);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_IS_PARTITIONED_HPP
|
Loading…
Add table
Add a link
Reference in a new issue