llvm-project/libcxx/include/cstddef

104 lines
2.4 KiB
Plaintext
Raw Normal View History

2010-05-12 03:42:16 +08:00
// -*- C++ -*-
//===--------------------------- cstddef ----------------------------------===//
//
// The LLVM Compiler Infrastructure
2010-05-12 03:42:16 +08:00
//
2010-11-17 06:09:02 +08:00
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
2010-05-12 03:42:16 +08:00
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_CSTDDEF
#define _LIBCPP_CSTDDEF
/*
cstddef synopsis
Macros:
offsetof(type,member-designator)
NULL
2010-05-12 03:42:16 +08:00
namespace std
{
Types:
ptrdiff_t
size_t
max_align_t
nullptr_t
} // std
*/
#include <__config>
2010-06-03 02:53:22 +08:00
#ifdef __GLIBC__
#define __need_NULL
#define __need_ptrdiff_t
#define __need_size_t
#endif // __GLIBC__
2010-06-03 02:53:22 +08:00
#include <stddef.h>
2010-05-12 03:42:16 +08:00
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2010-05-12 03:42:16 +08:00
#pragma GCC system_header
#endif
2010-05-12 03:42:16 +08:00
_LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
using ::size_t;
typedef long double max_align_t;
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct _LIBCPP_VISIBLE nullptr_t
2010-05-12 03:42:16 +08:00
{
void* __lx;
2010-05-12 03:42:16 +08:00
struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
2010-05-12 03:42:16 +08:00
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
2010-05-12 03:42:16 +08:00
2010-05-19 01:32:30 +08:00
template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
2010-05-19 01:32:30 +08:00
operator _Tp* () const {return 0;}
2010-05-12 03:42:16 +08:00
2010-05-19 01:32:30 +08:00
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
2010-05-19 01:32:30 +08:00
operator _Tp _Up::* () const {return 0;}
2010-05-12 03:42:16 +08:00
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
2010-05-12 03:42:16 +08:00
};
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
2010-05-12 03:42:16 +08:00
#define nullptr _VSTD::__get_nullptr_t()
2010-05-12 03:42:16 +08:00
#endif // _LIBCPP_HAS_NO_NULLPTR
2010-05-12 03:42:16 +08:00
_LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
2010-05-12 03:42:16 +08:00
#endif // _LIBCPP_CSTDDEF