| Index: base/nullptr.h
|
| diff --git a/base/nullptr.h b/base/nullptr.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4d563a5382d505a3dee4b303aa3b2f3eda6f7f70
|
| --- /dev/null
|
| +++ b/base/nullptr.h
|
| @@ -0,0 +1,39 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef BASE_NULLPTR_H_
|
| +#define BASE_NULLPTR_H_
|
| +
|
| +#include "base/base_export.h"
|
| +#include "build/build_config.h"
|
| +
|
| +#if defined(NULLPTR_IS_NATIVE_TYPE)
|
| +#include <cstddef>
|
| +#endif
|
| +
|
| +namespace base {
|
| +
|
| +#if defined(NULLPTR_IS_NATIVE_TYPE)
|
| +using std::nullptr_t;
|
| +#elif defined(__GLIBCXX__) && __GLIBCXX__ < 20110325
|
| +typedef decltype(nullptr) nullptr_t;
|
| +#else
|
| +class BASE_EXPORT nullptr_t {
|
| + public:
|
| + template <class T> operator T*() const { return NULL; }
|
| + template <class C, class T> operator T C::*() const { return NULL; }
|
| +
|
| + private:
|
| + void operator&() const;
|
| +};
|
| +#endif
|
| +
|
| +// Ideally, it would be possible to use base::nullptr across all platforms.
|
| +// However, nullptr is implemented as a reserved keyword in C++11, and thus,
|
| +// like "true" and "false", cannot be used as a name for a type.
|
| +extern BASE_EXPORT nullptr_t NullPtr;
|
| +
|
| +} // namespace base
|
| +
|
| +#endif // #define BASE_NULLPTR_H_
|
|
|