#ifndef SPROUT_RANGE_ADAPTOR_ADAPTED_DROPPED_HPP #define SPROUT_RANGE_ADAPTOR_ADAPTED_DROPPED_HPP #include #include #include #include #include namespace sprout { namespace adaptors { // // adapt_drop_holder // template class adapt_drop_holder { public: typedef Adaptor adaptor_type; typedef Difference difference_type; private: adaptor_type adaptor_; difference_type distance_; public: SPROUT_CONSTEXPR adapt_drop_holder(adaptor_type const& adaptor, difference_type distance) : adaptor_(adaptor), distance_(distance) {} SPROUT_CONSTEXPR adaptor_type const& adaptor() const { return adaptor_; } SPROUT_CONSTEXPR difference_type const& distance() const { return distance_; } }; // // adapted_dropped_forwarder // class adapted_dropped_forwarder { public: template SPROUT_CONSTEXPR sprout::adaptors::adapt_drop_holder operator()(Adaptor const& adaptor, Difference distance) const { return sprout::adaptors::adapt_drop_holder(adaptor, distance); } }; // // adapted_dropped // namespace { SPROUT_STATIC_CONSTEXPR sprout::adaptors::adapted_dropped_forwarder adapted_dropped = {}; } // anonymous-namespace // // operator| // template inline SPROUT_CONSTEXPR auto operator|(Range&& lhs, sprout::adaptors::adapt_drop_holder const& rhs) -> decltype( sprout::lvalue_forward(lhs) | sprout::adaptors::taken(rhs.distance()) | sprout::adaptors::jointed(sprout::lvalue_forward(lhs) | sprout::adaptors::dropped(rhs.distance()) | rhs.adaptor()) ) { return sprout::lvalue_forward(lhs) | sprout::adaptors::taken(rhs.distance()) | sprout::adaptors::jointed(sprout::lvalue_forward(lhs) | sprout::adaptors::dropped(rhs.distance()) | rhs.adaptor()) ; } } // namespace adaptors } // namespace sprout #endif // #ifndef SPROUT_RANGE_ADAPTOR_ADAPTED_DROPPED_HPP