codekingpro/portable-devtools
114k
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCUDACXX___ITERATOR_MOVE_SENTINEL_H11#define _LIBCUDACXX___ITERATOR_MOVE_SENTINEL_H12 13#ifndef __cuda_std__14#include <__config>15#endif // __cuda_std__16 17#include "../__concepts/assignable.h"18#include "../__concepts/convertible_to.h"19#include "../__concepts/semiregular.h"20#include "../__utility/move.h"21 22#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)23# pragma GCC system_header24#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)25# pragma clang system_header26#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)27# pragma system_header28#endif // no system header29 30#if _LIBCUDACXX_STD_VER > 1431 32_LIBCUDACXX_BEGIN_NAMESPACE_STD33 34#if _LIBCUDACXX_STD_VER > 1735template <semiregular _Sent>36#else37template<class _Sent, enable_if_t<semiregular<_Sent>, int> = 0>38#endif39class _LIBCUDACXX_TEMPLATE_VIS move_sentinel40{41public:42 _LIBCUDACXX_HIDE_FROM_ABI43 constexpr move_sentinel() = default;44 45 _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY constexpr46 explicit move_sentinel(_Sent __s) : __last_(_CUDA_VSTD::move(__s)) {}47 48 _LIBCUDACXX_TEMPLATE(class _S2)49 _LIBCUDACXX_REQUIRES( convertible_to<const _S2&, _Sent>)50 _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY constexpr51 move_sentinel(const move_sentinel<_S2>& __s) : __last_(__s.base()) {}52 53 _LIBCUDACXX_TEMPLATE(class _S2)54 _LIBCUDACXX_REQUIRES( assignable_from<const _S2&, _Sent>)55 _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_INLINE_VISIBILITY constexpr56 move_sentinel& operator=(const move_sentinel<_S2>& __s)57 { __last_ = __s.base(); return *this; }58 59 _LIBCUDACXX_INLINE_VISIBILITY constexpr _Sent base() const { return __last_; }60 61private:62 _Sent __last_ = _Sent();63};64 65_LIBCUDACXX_END_NAMESPACE_STD66 67#endif // _LIBCUDACXX_STD_VER > 1468 69#endif // _LIBCUDACXX___ITERATOR_MOVE_SENTINEL_H70 