2 //===--------------------------- cstddef ----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_CSTDDEF
12 #define _LIBCPP_CSTDDEF
19 offsetof(type,member-designator)
40 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
41 #pragma GCC system_header
44 _LIBCPP_BEGIN_NAMESPACE_STD
49 #if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
50 // Re-use the compiler's <stddef.h> max_align_t where possible.
53 typedef long double max_align_t;
56 #ifdef _LIBCPP_HAS_NO_NULLPTR
58 struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
62 struct __nat {int __for_bool_;};
64 _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
65 _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
67 _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
70 _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
71 operator _Tp* () const {return 0;}
73 template <class _Tp, class _Up>
75 operator _Tp _Up::* () const {return 0;}
77 friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
78 friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
79 friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
80 friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
81 friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
82 friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
85 inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
87 #define nullptr _VSTD::__get_nullptr_t()
89 #endif // _LIBCPP_HAS_NO_NULLPTR
91 _LIBCPP_END_NAMESPACE_STD
93 #ifndef _LIBCPP_HAS_NO_NULLPTR
97 typedef decltype(nullptr) nullptr_t;
100 #endif // _LIBCPP_HAS_NO_NULLPTR
102 #endif // _LIBCPP_CSTDDEF