File indexing completed on 2026-05-03 08:13:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___ITERATOR_MOVE_SENTINEL_H
0010 #define _LIBCPP___CXX03___ITERATOR_MOVE_SENTINEL_H
0011
0012 #include <__cxx03/__concepts/assignable.h>
0013 #include <__cxx03/__concepts/convertible_to.h>
0014 #include <__cxx03/__concepts/semiregular.h>
0015 #include <__cxx03/__config>
0016 #include <__cxx03/__utility/move.h>
0017
0018 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0019 # pragma GCC system_header
0020 #endif
0021
0022 _LIBCPP_PUSH_MACROS
0023 #include <__cxx03/__undef_macros>
0024
0025 _LIBCPP_BEGIN_NAMESPACE_STD
0026
0027 #if _LIBCPP_STD_VER >= 20
0028
0029 template <semiregular _Sent>
0030 class _LIBCPP_TEMPLATE_VIS move_sentinel {
0031 public:
0032 _LIBCPP_HIDE_FROM_ABI move_sentinel() = default;
0033
0034 _LIBCPP_HIDE_FROM_ABI constexpr explicit move_sentinel(_Sent __s) : __last_(std::move(__s)) {}
0035
0036 template <class _S2>
0037 requires convertible_to<const _S2&, _Sent>
0038 _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}
0039
0040 template <class _S2>
0041 requires assignable_from<_Sent&, const _S2&>
0042 _LIBCPP_HIDE_FROM_ABI constexpr move_sentinel& operator=(const move_sentinel<_S2>& __s) {
0043 __last_ = __s.base();
0044 return *this;
0045 }
0046
0047 _LIBCPP_HIDE_FROM_ABI constexpr _Sent base() const { return __last_; }
0048
0049 private:
0050 _Sent __last_ = _Sent();
0051 };
0052
0053 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel);
0054
0055 #endif
0056
0057 _LIBCPP_END_NAMESPACE_STD
0058
0059 _LIBCPP_POP_MACROS
0060
0061 #endif