/// \file // Range v3 library // // Copyright Eric Niebler 2013-present // // Use, modification and distribution is subject to the // Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Project home: https://github.com/ericniebler/range-v3 // #ifndef RANGES_V3_VIEW_MOVE_HPP #define RANGES_V3_VIEW_MOVE_HPP #include #include #include #include #include #include #include #include #include #include #include namespace ranges { /// \addtogroup group-views /// @{ template struct move_view : view_adaptor, Rng> { private: friend range_access; template struct adaptor : adaptor_base { adaptor() = default; CPP_template(bool Other)( // requires Const && (!Other)) constexpr adaptor(adaptor) {} using CRng = meta::const_if_c; using value_type = range_value_t; range_rvalue_reference_t read(iterator_t const & it) const { return ranges::iter_move(it); } range_rvalue_reference_t iter_move(iterator_t const & it) const { return ranges::iter_move(it); } }; adaptor()> begin_adaptor() { return {}; } adaptor()> end_adaptor() { return {}; } CPP_member auto begin_adaptor() const -> CPP_ret(adaptor)( // requires input_range) { return {}; } CPP_member auto end_adaptor() const -> CPP_ret(adaptor)( // requires input_range) { return {}; } public: move_view() = default; explicit move_view(Rng rng) : move_view::view_adaptor{std::move(rng)} {} CPP_member auto CPP_fun(size)()(const requires sized_range) { return ranges::size(this->base()); } CPP_member auto CPP_fun(size)()(requires sized_range) { return ranges::size(this->base()); } }; #if RANGES_CXX_DEDUCTION_GUIDES >= RANGES_CXX_DEDUCTION_GUIDES_17 template move_view(Rng &&)->move_view>; #endif namespace views { struct move_fn { template auto operator()(Rng && rng) const -> CPP_ret(move_view>)( // requires viewable_range && input_range) { return move_view>{all(static_cast(rng))}; } }; /// \relates move_fn /// \ingroup group-views RANGES_INLINE_VARIABLE(view, move) } // namespace views /// @} } // namespace ranges #include RANGES_SATISFY_BOOST_RANGE(::ranges::move_view) #endif