Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: base/nullptr.h

Issue 11411318: DO NOT COMMIT: NullPtr support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/memory/scoped_ptr.h ('k') | base/nullptr.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_NULLPTR_H_
6 #define BASE_NULLPTR_H_
7
8 #include "base/base_export.h"
9 #include "build/build_config.h"
10
11 #if defined(NULLPTR_IS_NATIVE_TYPE)
12 #include <cstddef>
13 #endif
14
15 namespace base {
16
17 #if defined(NULLPTR_IS_NATIVE_TYPE)
18 using std::nullptr_t;
19 #elif defined(__GLIBCXX__) && __GLIBCXX__ < 20110325
20 typedef decltype(nullptr) nullptr_t;
21 #else
22 class BASE_EXPORT nullptr_t {
23 public:
24 template <class T> operator T*() const { return NULL; }
25 template <class C, class T> operator T C::*() const { return NULL; }
26
27 private:
28 void operator&() const;
29 };
30 #endif
31
32 // Ideally, it would be possible to use base::nullptr across all platforms.
33 // However, nullptr is implemented as a reserved keyword in C++11, and thus,
34 // like "true" and "false", cannot be used as a name for a type.
35 extern BASE_EXPORT nullptr_t NullPtr;
36
37 } // namespace base
38
39 #endif // #define BASE_NULLPTR_H_
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr.h ('k') | base/nullptr.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698