mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add algorithm one_of, all_of_equal, any_of_equal, none_of_equal, one_of_equal, is_increasing, is_decreasing, is_strictly_increasing, is_strictly_decreasing
This commit is contained in:
parent
1ef528d204
commit
de41f5c880
22 changed files with 425 additions and 3 deletions
21
sprout/range/algorithm/all_of_equal.hpp
Normal file
21
sprout/range/algorithm/all_of_equal.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_ALL_OF_EQUAL_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_ALL_OF_EQUAL_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/all_of_equal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// all_of_equal
|
||||
//
|
||||
template<typename Range, typename T>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
all_of_equal(Range const& range, T const& value) {
|
||||
return sprout::all_of_equal(sprout::begin(range), sprout::end(range), value);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_ALL_OF_EQUAL_HPP
|
21
sprout/range/algorithm/any_of_equal.hpp
Normal file
21
sprout/range/algorithm/any_of_equal.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_ALL_OF_EQUAL_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_ALL_OF_EQUAL_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/any_of_equal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// any_of_equal
|
||||
//
|
||||
template<typename Range, typename T>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
any_of_equal(Range const& range, T const& value) {
|
||||
return sprout::any_of_equal(sprout::begin(range), sprout::end(range), value);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_ALL_OF_EQUAL_HPP
|
21
sprout/range/algorithm/is_decreasing.hpp
Normal file
21
sprout/range/algorithm/is_decreasing.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_IS_DECREASING_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_IS_DECREASING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/is_decreasing.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// is_decreasing
|
||||
//
|
||||
template<typename Range>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_decreasing(Range const& range) {
|
||||
return sprout::is_decreasing(sprout::begin(range), sprout::end(range));
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_IS_DECREASING_HPP
|
21
sprout/range/algorithm/is_increasing.hpp
Normal file
21
sprout/range/algorithm/is_increasing.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_IS_INCREASING_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_IS_INCREASING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/is_increasing.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// is_increasing
|
||||
//
|
||||
template<typename Range>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_increasing(Range const& range) {
|
||||
return sprout::is_increasing(sprout::begin(range), sprout::end(range));
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_IS_INCREASING_HPP
|
21
sprout/range/algorithm/is_strictly_decreasing.hpp
Normal file
21
sprout/range/algorithm/is_strictly_decreasing.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_IS_STRICTLY_DECREASING_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_IS_STRICTLY_DECREASING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/is_strictly_decreasing.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// is_strictly_decreasing
|
||||
//
|
||||
template<typename Range>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_strictly_decreasing(Range const& range) {
|
||||
return sprout::is_strictly_decreasing(sprout::begin(range), sprout::end(range));
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_IS_STRICTLY_DECREASING_HPP
|
21
sprout/range/algorithm/is_strictly_increasing.hpp
Normal file
21
sprout/range/algorithm/is_strictly_increasing.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_IS_STRICTLY_INCREASING_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_IS_STRICTLY_INCREASING_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/is_strictly_increasing.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// is_strictly_increasing
|
||||
//
|
||||
template<typename Range>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_strictly_increasing(Range const& range) {
|
||||
return sprout::is_strictly_increasing(sprout::begin(range), sprout::end(range));
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_IS_STRICTLY_INCREASING_HPP
|
|
@ -5,6 +5,7 @@
|
|||
#include <sprout/range/algorithm/all_of.hpp>
|
||||
#include <sprout/range/algorithm/any_of.hpp>
|
||||
#include <sprout/range/algorithm/none_of.hpp>
|
||||
#include <sprout/range/algorithm/one_of.hpp>
|
||||
#include <sprout/range/algorithm/find.hpp>
|
||||
#include <sprout/range/algorithm/find_if.hpp>
|
||||
#include <sprout/range/algorithm/find_if_not.hpp>
|
||||
|
@ -33,5 +34,13 @@
|
|||
#include <sprout/range/algorithm/max_element.hpp>
|
||||
#include <sprout/range/algorithm/minmax_element.hpp>
|
||||
#include <sprout/range/algorithm/lexicographical_compare.hpp>
|
||||
#include <sprout/range/algorithm/all_of_equal.hpp>
|
||||
#include <sprout/range/algorithm/any_of_equal.hpp>
|
||||
#include <sprout/range/algorithm/none_of_equal.hpp>
|
||||
#include <sprout/range/algorithm/one_of_equal.hpp>
|
||||
#include <sprout/range/algorithm/is_increasing.hpp>
|
||||
#include <sprout/range/algorithm/is_decreasing.hpp>
|
||||
#include <sprout/range/algorithm/is_strictly_increasing.hpp>
|
||||
#include <sprout/range/algorithm/is_strictly_decreasing.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_NON_MODIFYIING_HPP
|
||||
|
|
21
sprout/range/algorithm/none_of_equal.hpp
Normal file
21
sprout/range/algorithm/none_of_equal.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_NONE_OF_EQUAL_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_NONE_OF_EQUAL_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/none_of_equal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// none_of_equal
|
||||
//
|
||||
template<typename Range, typename T>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
none_of_equal(Range const& range, T const& value) {
|
||||
return sprout::none_of_equal(sprout::begin(range), sprout::end(range), value);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_NONE_OF_EQUAL_HPP
|
21
sprout/range/algorithm/one_of.hpp
Normal file
21
sprout/range/algorithm/one_of.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_ONE_OF_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_ONE_OF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/one_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// one_of
|
||||
//
|
||||
template<typename Range, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
one_of(Range const& range, Predicate pred) {
|
||||
return sprout::one_of(sprout::begin(range), sprout::end(range), pred);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_ONE_OF_HPP
|
21
sprout/range/algorithm/one_of_equal.hpp
Normal file
21
sprout/range/algorithm/one_of_equal.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_RANGE_ALGORITHM_ONE_OF_EQUAL_HPP
|
||||
#define SPROUT_RANGE_ALGORITHM_ONE_OF_EQUAL_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/one_of_equal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace range {
|
||||
//
|
||||
// one_of_equal
|
||||
//
|
||||
template<typename Range, typename T>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
one_of_equal(Range const& range, T const& value) {
|
||||
return sprout::one_of_equal(sprout::begin(range), sprout::end(range), value);
|
||||
}
|
||||
} // namespace range
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANGE_ALGORITHM_ONE_OF_EQUAL_HPP
|
|
@ -20,7 +20,7 @@ namespace sprout {
|
|||
}
|
||||
template<typename Input, typename Result, typename BinaryOperation>
|
||||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
partial_sum(Input const& input, Result const& result,BinaryOperation binary_op) {
|
||||
partial_sum(Input const& input, Result const& result, BinaryOperation binary_op) {
|
||||
return sprout::fixed::partial_sum(sprout::begin(input), sprout::end(input), result, binary_op);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue