2015-10-09 04:34:11 +08:00
|
|
|
// -*- C++ -*-
|
2021-11-18 05:25:01 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2015-10-09 04:34:11 +08:00
|
|
|
//
|
2019-01-19 18:56:40 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-10-09 04:34:11 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_NULLPTR
|
|
|
|
#define _LIBCPP_NULLPTR
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
|
|
#pragma GCC system_header
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
2017-01-05 07:56:00 +08:00
|
|
|
struct _LIBCPP_TEMPLATE_VIS nullptr_t
|
2015-10-09 04:34:11 +08:00
|
|
|
{
|
|
|
|
void* __lx;
|
|
|
|
|
|
|
|
struct __nat {int __for_bool_;};
|
|
|
|
|
2018-07-12 07:14:33 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
|
|
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
2015-10-09 04:34:11 +08:00
|
|
|
|
2018-07-12 07:14:33 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
2015-10-09 04:34:11 +08:00
|
|
|
|
|
|
|
template <class _Tp>
|
2018-07-12 07:14:33 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
2015-10-09 04:34:11 +08:00
|
|
|
operator _Tp* () const {return 0;}
|
|
|
|
|
|
|
|
template <class _Tp, class _Up>
|
2018-07-12 07:14:33 +08:00
|
|
|
_LIBCPP_INLINE_VISIBILITY
|
2015-10-09 04:34:11 +08:00
|
|
|
operator _Tp _Up::* () const {return 0;}
|
|
|
|
|
2018-07-12 07:14:33 +08:00
|
|
|
friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
|
|
|
friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
2015-10-09 04:34:11 +08:00
|
|
|
};
|
|
|
|
|
2018-07-12 07:14:33 +08:00
|
|
|
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
2015-10-09 04:34:11 +08:00
|
|
|
|
|
|
|
#define nullptr _VSTD::__get_nullptr_t()
|
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
|
|
|
#else // _LIBCPP_HAS_NO_NULLPTR
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
typedef decltype(nullptr) nullptr_t;
|
2021-12-02 21:12:51 +08:00
|
|
|
} // namespace std
|
2015-10-09 04:34:11 +08:00
|
|
|
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_HAS_NO_NULLPTR
|
2015-10-09 04:34:11 +08:00
|
|
|
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_NULLPTR
|