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

Side by Side Diff: Source/wtf/NullPtr.h

Issue 322913002: add a user-provided constructor to emulated c++11 NullPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 2
3 Copyright (C) 2010 Apple Inc. All rights reserved. 3 Copyright (C) 2010 Apple Inc. All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions 6 modification, are permitted provided that the following conditions
7 are met: 7 are met:
8 1. Redistributions of source code must retain the above copyright 8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer. 9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright 10 2. Redistributions in binary form must reproduce the above copyright
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 namespace std { 42 namespace std {
43 typedef decltype(nullptr) nullptr_t; 43 typedef decltype(nullptr) nullptr_t;
44 } 44 }
45 #endif 45 #endif
46 46
47 #else 47 #else
48 48
49 namespace std { 49 namespace std {
50 class nullptr_t { 50 class nullptr_t {
51 public: 51 public:
52 // Required to create uninitialized const nullptr's.
Peter Kasting 2014/06/09 23:07:00 Nit: Do not use an apostrophe to make something pl
Mostyn Bramley-Moore 2014/06/09 23:33:30 Rephrased to avoid the apostrophe, hopefully it's
53 nullptr_t() { }
54
52 // Make nullptr convertible to any pointer type. 55 // Make nullptr convertible to any pointer type.
53 template<typename T> operator T*() const { return 0; } 56 template<typename T> operator T*() const { return 0; }
54 // Make nullptr convertible to any member pointer type. 57 // Make nullptr convertible to any member pointer type.
55 template<typename C, typename T> operator T C::*() { return 0; } 58 template<typename C, typename T> operator T C::*() { return 0; }
56 private: 59 private:
57 // Do not allow taking the address of nullptr. 60 // Do not allow taking the address of nullptr.
58 void operator&(); 61 void operator&();
59 }; 62 };
60 } 63 }
61 WTF_EXPORT extern const std::nullptr_t nullptr; 64 WTF_EXPORT extern const std::nullptr_t nullptr;
(...skipping 10 matching lines...) Expand all
72 #else 75 #else
73 #define WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(ClassName) \ 76 #define WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(ClassName) \
74 private: \ 77 private: \
75 ClassName(int) 78 ClassName(int)
76 #define WTF_DISALLOW_ZERO_ASSIGNMENT(ClassName) \ 79 #define WTF_DISALLOW_ZERO_ASSIGNMENT(ClassName) \
77 private: \ 80 private: \
78 ClassName& operator=(int) 81 ClassName& operator=(int)
79 #endif 82 #endif
80 83
81 #endif 84 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698