1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

add adaptor piped, taken, dropped, window, offset, adapted_xxx

This commit is contained in:
bolero-MURAKAMI 2012-11-24 13:04:02 +09:00
parent 5c9a8153de
commit cc4ade67fd
47 changed files with 1349 additions and 76 deletions

View file

@ -2,6 +2,7 @@
#define SPROUT_ITERATOR_GENERATOR_ITERATOR_HPP
#include <cstddef>
#include <limits>
#include <iterator>
#include <utility>
#include <stdexcept>
@ -36,15 +37,13 @@ namespace sprout {
difference_type count_;
public:
SPROUT_CONSTEXPR generator_iterator()
: gen_()
, count_()
: gen_(), count_()
{}
explicit SPROUT_CONSTEXPR generator_iterator(
generator_type const& gen,
difference_type count = -1
difference_type count = std::numeric_limits<difference_type>::max()
)
: gen_(gen)
, count_(count)
: gen_(gen), count_(count)
{}
generator_type& generator() {
return gen_;

View file

@ -2,6 +2,7 @@
#define SPROUT_ITERATOR_VALUE_ITERATOR_HPP
#include <cstddef>
#include <limits>
#include <iterator>
#include <utility>
#include <stdexcept>
@ -52,19 +53,19 @@ namespace sprout {
sprout::value_holder<T> holder_;
difference_type count_;
private:
SPROUT_CONSTEXPR value_iterator(sprout::value_holder<T> const& r, std::size_t count)
: holder_(r)
, count_(count)
SPROUT_CONSTEXPR value_iterator(sprout::value_holder<T> const& r, difference_type count)
: holder_(r), count_(count)
{}
public:
SPROUT_CONSTEXPR value_iterator()
: holder_()
, count_()
: holder_(), count_()
{}
value_iterator(value_iterator const&) = default;
explicit SPROUT_CONSTEXPR value_iterator(typename sprout::value_holder<T>::param_type p, std::size_t count = -1)
: holder_(p)
, count_(count)
explicit SPROUT_CONSTEXPR value_iterator(
typename sprout::value_holder<T>::param_type p,
difference_type count = std::numeric_limits<difference_type>::max()
)
: holder_(p), count_(count)
{}
operator value_iterator<const_type>() const {
return value_iterator<const_type>(holder_.get(), count_);