2010-05-12 03:42:16 +08:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===--------------------------- cstddef ----------------------------------===//
|
|
|
|
//
|
2010-05-12 05:36:01 +08:00
|
|
|
// 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-08-22 08:02:43 +08:00
|
|
|
|
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
|
2010-08-22 08:02:43 +08:00
|
|
|
#endif // __GLIBC__
|
2010-06-03 02:53:22 +08:00
|
|
|
|
2010-05-29 02:04:31 +08:00
|
|
|
#include <stddef.h>
|
2010-05-12 03:42:16 +08:00
|
|
|
|
2011-10-18 04:05:10 +08:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2010-05-12 03:42:16 +08:00
|
|
|
#pragma GCC system_header
|
2011-10-18 04:05:10 +08:00
|
|
|
#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
|
|
|
|
|
2010-09-22 05:28:23 +08:00
|
|
|
struct _LIBCPP_VISIBLE nullptr_t
|
2010-05-12 03:42:16 +08:00
|
|
|
{
|
2012-10-31 03:06:59 +08:00
|
|
|
void* __lx;
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
struct __nat {int __for_bool_;};
|
|
|
|
|
2012-10-31 03:06:59 +08:00
|
|
|
_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
|
|
|
|
2012-09-25 07:36:40 +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>
|
2012-09-25 07:36:40 +08:00
|
|
|
_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>
|
2010-08-22 08:02:43 +08:00
|
|
|
_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
|
|
|
|
2012-09-25 07:36:40 +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
|
|
|
};
|
|
|
|
|
2012-09-25 07:36:40 +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
|
|
|
|
2011-07-01 05:18:19 +08:00
|
|
|
#define nullptr _VSTD::__get_nullptr_t()
|
2010-05-12 03:42:16 +08:00
|
|
|
|
2010-08-22 08:02:43 +08:00
|
|
|
#endif // _LIBCPP_HAS_NO_NULLPTR
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
2011-06-05 21:00:46 +08:00
|
|
|
#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
|