2010-05-11 19:42:16 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===--------------------------- cstddef ----------------------------------===//
|
|
|
|
//
|
2010-05-11 21:36:01 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 19:42:16 +00:00
|
|
|
//
|
2010-11-16 22:09:02 +00:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 19:42:16 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_CSTDDEF
|
|
|
|
#define _LIBCPP_CSTDDEF
|
|
|
|
|
|
|
|
/*
|
|
|
|
cstddef synopsis
|
|
|
|
|
|
|
|
Macros:
|
|
|
|
|
|
|
|
offsetof(type,member-designator)
|
|
|
|
NULL
|
2010-08-22 00:02:43 +00:00
|
|
|
|
2010-05-11 19:42:16 +00:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
|
|
|
|
Types:
|
|
|
|
|
|
|
|
ptrdiff_t
|
|
|
|
size_t
|
|
|
|
max_align_t
|
|
|
|
nullptr_t
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
2010-06-02 18:53:22 +00:00
|
|
|
|
2010-05-28 18:04:31 +00:00
|
|
|
#include <stddef.h>
|
2010-05-11 19:42:16 +00:00
|
|
|
|
2011-10-17 20:05:10 +00:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2010-05-11 19:42:16 +00:00
|
|
|
#pragma GCC system_header
|
2011-10-17 20:05:10 +00:00
|
|
|
#endif
|
2010-05-11 19:42:16 +00:00
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
|
|
|
using ::ptrdiff_t;
|
|
|
|
using ::size_t;
|
|
|
|
|
2014-02-21 08:37:30 +00:00
|
|
|
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
|
|
|
|
// Re-use the compiler's <stddef.h> max_align_t where possible.
|
|
|
|
using ::max_align_t;
|
|
|
|
#else
|
2010-05-11 19:42:16 +00:00
|
|
|
typedef long double max_align_t;
|
2014-02-21 08:37:30 +00:00
|
|
|
#endif
|
2010-05-11 19:42:16 +00:00
|
|
|
|
|
|
|
#ifdef _LIBCPP_HAS_NO_NULLPTR
|
|
|
|
|
2013-08-12 18:38:34 +00:00
|
|
|
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
|
2010-05-11 19:42:16 +00:00
|
|
|
{
|
2012-10-30 19:06:59 +00:00
|
|
|
void* __lx;
|
2010-05-11 19:42:16 +00:00
|
|
|
|
|
|
|
struct __nat {int __for_bool_;};
|
|
|
|
|
2012-10-30 19:06:59 +00:00
|
|
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
|
|
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
2010-05-11 19:42:16 +00:00
|
|
|
|
2012-09-24 23:36:40 +00:00
|
|
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
2010-05-11 19:42:16 +00:00
|
|
|
|
2010-05-18 17:32:30 +00:00
|
|
|
template <class _Tp>
|
2012-09-24 23:36:40 +00:00
|
|
|
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
2010-05-18 17:32:30 +00:00
|
|
|
operator _Tp* () const {return 0;}
|
2010-05-11 19:42:16 +00:00
|
|
|
|
2010-05-18 17:32:30 +00:00
|
|
|
template <class _Tp, class _Up>
|
2010-08-22 00:02:43 +00:00
|
|
|
_LIBCPP_ALWAYS_INLINE
|
2010-05-18 17:32:30 +00:00
|
|
|
operator _Tp _Up::* () const {return 0;}
|
2010-05-11 19:42:16 +00:00
|
|
|
|
2012-09-24 23:36:40 +00: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-11 19:42:16 +00:00
|
|
|
};
|
|
|
|
|
2012-09-24 23:36:40 +00:00
|
|
|
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
2010-05-11 19:42:16 +00:00
|
|
|
|
2011-06-30 21:18:19 +00:00
|
|
|
#define nullptr _VSTD::__get_nullptr_t()
|
2010-05-11 19:42:16 +00:00
|
|
|
|
2010-08-22 00:02:43 +00:00
|
|
|
#endif // _LIBCPP_HAS_NO_NULLPTR
|
2010-05-11 19:42:16 +00:00
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
2011-06-05 13:00:46 +00:00
|
|
|
#ifndef _LIBCPP_HAS_NO_NULLPTR
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
typedef decltype(nullptr) nullptr_t;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _LIBCPP_HAS_NO_NULLPTR
|
|
|
|
|
2010-05-11 19:42:16 +00:00
|
|
|
#endif // _LIBCPP_CSTDDEF
|