diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 23:42:16 +0400 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 23:42:16 +0400 |
commit | 3e519524c118651123eecf60c2bbc5d65ad9bac3 (patch) | |
tree | b2dd4168cfe448920a602cd7d2e40f95da187153 /libcxx/include/cstddef | |
parent | 9132c59d43b6c590c9bb33496eebf9f192d6857a (diff) |
libcxx initial import
llvm-svn: 103490
Diffstat (limited to 'libcxx/include/cstddef')
-rw-r--r-- | libcxx/include/cstddef | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef new file mode 100644 index 000000000000..6b0a1c71db40 --- /dev/null +++ b/libcxx/include/cstddef @@ -0,0 +1,88 @@ +// -*- C++ -*- +//===--------------------------- cstddef ----------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_CSTDDEF +#define _LIBCPP_CSTDDEF + +/* + cstddef synopsis + +Macros: + + offsetof(type,member-designator) + NULL + +namespace std +{ + +Types: + + ptrdiff_t + size_t + max_align_t + nullptr_t + +} // std + +*/ + +#include <__config> +#include <stddef.h> + +#pragma GCC system_header + +_LIBCPP_BEGIN_NAMESPACE_STD + +using ::ptrdiff_t; +using ::size_t; + +typedef long double max_align_t; + +#ifdef _LIBCPP_HAS_NO_NULLPTR + +struct nullptr_t +{ + void* _; + + struct __nat {int __for_bool_;}; + + _LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {} + + _LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;} + + template <class T> + _LIBCPP_ALWAYS_INLINE + operator T* () const {return 0;} + + template <class T, class U> + _LIBCPP_ALWAYS_INLINE + operator T U::* () const {return 0;} + + friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;} + friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;} + friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;} + friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;} + friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;} + friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;} +}; + +inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);} + +#define nullptr _STD::__get_nullptr_t() + +#else + +typedef decltype(nullptr) nullptr_t; + +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_CSTDDEF |