Changeset View
Changeset View
Standalone View
Standalone View
libcxx/include/__algorithm/ranges_move_backward.h
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#ifndef _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H | #ifndef _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H | ||||
#define _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H | #define _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H | ||||
#include <__algorithm/in_out_result.h> | #include <__algorithm/in_out_result.h> | ||||
#include <__algorithm/ranges_move.h> | #include <__algorithm/iterator_operations.h> | ||||
#include <__algorithm/move_backward.h> | |||||
#include <__config> | #include <__config> | ||||
#include <__iterator/concepts.h> | #include <__iterator/concepts.h> | ||||
#include <__iterator/iter_move.h> | #include <__iterator/iter_move.h> | ||||
#include <__iterator/next.h> | #include <__iterator/next.h> | ||||
#include <__iterator/reverse_iterator.h> | |||||
#include <__ranges/access.h> | #include <__ranges/access.h> | ||||
#include <__ranges/concepts.h> | #include <__ranges/concepts.h> | ||||
#include <__ranges/dangling.h> | #include <__ranges/dangling.h> | ||||
#include <__utility/move.h> | #include <__utility/move.h> | ||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||||
# pragma GCC system_header | # pragma GCC system_header | ||||
#endif | #endif | ||||
#if _LIBCPP_STD_VER > 17 | #if _LIBCPP_STD_VER > 17 | ||||
_LIBCPP_BEGIN_NAMESPACE_STD | _LIBCPP_BEGIN_NAMESPACE_STD | ||||
namespace ranges { | namespace ranges { | ||||
template <class _InIter, class _OutIter> | template <class _InIter, class _OutIter> | ||||
using move_backward_result = in_out_result<_InIter, _OutIter>; | using move_backward_result = in_out_result<_InIter, _OutIter>; | ||||
namespace __move_backward { | namespace __move_backward { | ||||
struct __fn { | struct __fn { | ||||
template <class _InIter, class _Sent, class _OutIter> | template <class _InIter, class _Sent, class _OutIter> | ||||
_LIBCPP_HIDE_FROM_ABI constexpr static | _LIBCPP_HIDE_FROM_ABI constexpr static | ||||
move_backward_result<_InIter, _OutIter> __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) { | move_backward_result<_InIter, _OutIter> __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) { | ||||
auto __last_iter = ranges::next(__first, std::move(__last)); | auto __ret = std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result)); | ||||
auto __ret = ranges::move(std::make_reverse_iterator(__last_iter), | return {std::move(__ret.first), std::move(__ret.second)}; | ||||
std::make_reverse_iterator(__first), | |||||
std::make_reverse_iterator(__result)); | |||||
return {std::move(__last_iter), std::move(__ret.out.base())}; | |||||
} | } | ||||
template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter> | template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter> | ||||
requires indirectly_movable<_InIter, _OutIter> | requires indirectly_movable<_InIter, _OutIter> | ||||
_LIBCPP_HIDE_FROM_ABI constexpr | _LIBCPP_HIDE_FROM_ABI constexpr | ||||
move_backward_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const { | move_backward_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const { | ||||
return __move_backward_impl(std::move(__first), std::move(__last), std::move(__result)); | return __move_backward_impl(std::move(__first), std::move(__last), std::move(__result)); | ||||
} | } | ||||
Show All 21 Lines |