1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00
Sprout/sprout/algorithm/is_partitioned.hpp

23 lines
691 B
C++
Raw Normal View History

2012-04-01 13:15:09 +00:00
#ifndef SPROUT_ALGORITHM_IS_PARTITIONED_HPP
#define SPROUT_ALGORITHM_IS_PARTITIONED_HPP
#include <sprout/config.hpp>
#include <sprout/algorithm/none_of.hpp>
#include <sprout/algorithm/find_if_not.hpp>
2012-04-01 13:15:09 +00:00
namespace sprout {
// 25.3.13 Partitions
//
// recursion depth:
// [first, last) is RandomAccessIterator -> O(log N)
// otherwise -> O(N)
//
2012-04-01 13:15:09 +00:00
template<typename InputIterator, typename Predicate>
2012-10-06 04:53:07 +00:00
inline SPROUT_CONSTEXPR bool
is_partitioned(InputIterator first, InputIterator last, Predicate pred) {
return sprout::none_of(sprout::find_if_not(first, last, pred), last, pred);
2012-04-01 13:15:09 +00:00
}
} // namespace sprout
#endif // #ifndef SPROUT_ALGORITHM_IS_PARTITIONED_HPP