mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add compost some ranges.
This commit is contained in:
parent
cc4ade67fd
commit
05f75bef27
19 changed files with 289 additions and 13 deletions
|
@ -52,13 +52,13 @@ namespace sprout {
|
|||
iterator(sprout::end(range), low, up, comp)
|
||||
)
|
||||
{}
|
||||
SPROUT_CONSTEXPR compare_type const& compare() const {
|
||||
SPROUT_CONSTEXPR compare_type compare() const {
|
||||
return base_type::begin().compare();
|
||||
}
|
||||
SPROUT_CONSTEXPR value_type const& lower() const {
|
||||
SPROUT_CONSTEXPR value_type lower() const {
|
||||
return base_type::begin().lower();
|
||||
}
|
||||
SPROUT_CONSTEXPR value_type const& upper() const {
|
||||
SPROUT_CONSTEXPR value_type upper() const {
|
||||
return base_type::begin().upper();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define SPROUT_RANGE_ADAPTOR_PIPED_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
@ -88,9 +89,9 @@ namespace sprout {
|
|||
template<typename Range>
|
||||
SPROUT_CONSTEXPR auto
|
||||
apply(Range&& range) const
|
||||
-> decltype(sprout::adaptors::detail::apply_adaptors_tuple(sprout::forward<Range>(range), adaptors_))
|
||||
-> decltype(sprout::adaptors::detail::apply_adaptors_tuple(sprout::forward<Range>(range), std::declval<pipe_holder const&>().adaptors()))
|
||||
{
|
||||
return sprout::adaptors::detail::apply_adaptors_tuple(sprout::forward<Range>(range), adaptors_);
|
||||
return sprout::adaptors::detail::apply_adaptors_tuple(sprout::forward<Range>(range), adaptors());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace sprout {
|
|||
: old_(old_value)
|
||||
, new_(new_value)
|
||||
{}
|
||||
SPROUT_CONSTEXPR T const& operator()(T const& value) const {
|
||||
SPROUT_CONSTEXPR T operator()(T const& value) const {
|
||||
return (value == old_) ? new_ : value;
|
||||
}
|
||||
};
|
||||
|
@ -84,10 +84,10 @@ namespace sprout {
|
|||
: old_(old_value)
|
||||
, new_(new_value)
|
||||
{}
|
||||
SPROUT_CONSTEXPR value_type old_value() const {
|
||||
SPROUT_CONSTEXPR value_type const& old_value() const {
|
||||
return old_;
|
||||
}
|
||||
SPROUT_CONSTEXPR value_type new_value() const {
|
||||
SPROUT_CONSTEXPR value_type const& new_value() const {
|
||||
return new_;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace sprout {
|
|||
: pred_(pred)
|
||||
, new_(new_value)
|
||||
{}
|
||||
SPROUT_CONSTEXPR T const& operator()(T const& value) const {
|
||||
SPROUT_CONSTEXPR T operator()(T const& value) const {
|
||||
return pred_(value) ? new_ : value;
|
||||
}
|
||||
};
|
||||
|
@ -86,10 +86,10 @@ namespace sprout {
|
|||
: pred_(pred)
|
||||
, new_(new_value)
|
||||
{}
|
||||
SPROUT_CONSTEXPR predicate_type predicate() const {
|
||||
SPROUT_CONSTEXPR predicate_type const& predicate() const {
|
||||
return pred_;
|
||||
}
|
||||
SPROUT_CONSTEXPR value_type new_value() const {
|
||||
SPROUT_CONSTEXPR value_type const& new_value() const {
|
||||
return new_;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue