codekingpro/portable-devtools
114k
1// -*- C++ -*-2//===--------------------------- __nullptr --------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCUDACXX_NULLPTR11#define _LIBCUDACXX_NULLPTR12 13#include <__config>14 15#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)16# pragma GCC system_header17#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)18# pragma clang system_header19#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)20# pragma system_header21#endif // no system header22 23#ifdef _LIBCUDACXX_HAS_NO_NULLPTR24 25_LIBCUDACXX_BEGIN_NAMESPACE_STD26 27struct _LIBCUDACXX_TEMPLATE_VIS nullptr_t28{29 void* __lx;30 31 struct __nat {int __for_bool_;};32 33 _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t() : __lx(0) {}34 _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t(int __nat::*) : __lx(0) {}35 36 _LIBCUDACXX_INLINE_VISIBILITY constexpr operator int __nat::*() const {return 0;}37 38 template <class _Tp>39 _LIBCUDACXX_INLINE_VISIBILITY constexpr40 operator _Tp* () const {return 0;}41 42 template <class _Tp, class _Up>43 _LIBCUDACXX_INLINE_VISIBILITY44 operator _Tp _Up::* () const {return 0;}45 46 friend _LIBCUDACXX_INLINE_VISIBILITY constexpr bool operator==(nullptr_t, nullptr_t) {return true;}47 friend _LIBCUDACXX_INLINE_VISIBILITY constexpr bool operator!=(nullptr_t, nullptr_t) {return false;}48};49 50inline _LIBCUDACXX_INLINE_VISIBILITY constexpr nullptr_t __get_nullptr_t() {return nullptr_t(0);}51 52#define nullptr _CUDA_VSTD::__get_nullptr_t()53 54_LIBCUDACXX_END_NAMESPACE_STD55 56#else // _LIBCUDACXX_HAS_NO_NULLPTR57 58namespace std59{60 typedef decltype(nullptr) nullptr_t;61}62 63#endif // _LIBCUDACXX_HAS_NO_NULLPTR64 65#endif // _LIBCUDACXX_NULLPTR66 