Path: blob/main/contrib/llvm-project/libcxx/include/__iterator/move_sentinel.h
35233 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___ITERATOR_MOVE_SENTINEL_H9#define _LIBCPP___ITERATOR_MOVE_SENTINEL_H1011#include <__concepts/assignable.h>12#include <__concepts/convertible_to.h>13#include <__concepts/semiregular.h>14#include <__config>15#include <__utility/move.h>1617#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18# pragma GCC system_header19#endif2021_LIBCPP_PUSH_MACROS22#include <__undef_macros>2324_LIBCPP_BEGIN_NAMESPACE_STD2526#if _LIBCPP_STD_VER >= 202728template <semiregular _Sent>29class _LIBCPP_TEMPLATE_VIS move_sentinel {30public:31_LIBCPP_HIDE_FROM_ABI move_sentinel() = default;3233_LIBCPP_HIDE_FROM_ABI constexpr explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {}3435template <class _S2>36requires convertible_to<const _S2&, _Sent>37_LIBCPP_HIDE_FROM_ABI constexpr move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}3839template <class _S2>40requires assignable_from<_Sent&, const _S2&>41_LIBCPP_HIDE_FROM_ABI constexpr move_sentinel& operator=(const move_sentinel<_S2>& __s) {42__last_ = __s.base();43return *this;44}4546_LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; }4748private:49_Sent __last_ = _Sent();50};5152_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel);5354#endif // _LIBCPP_STD_VER >= 205556_LIBCPP_END_NAMESPACE_STD5758_LIBCPP_POP_MACROS5960#endif // _LIBCPP___ITERATOR_MOVE_SENTINEL_H616263