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

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: another attempt at a readable comment 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 in order to create const nullptr_t objects without an
53 // explicit initializer, a la:
Mikhail 2014/06/10 07:15:24 As I see at https://gcc.gnu.org/bugzilla/show_bug.
Mostyn Bramley-Moore 2014/06/10 07:33:58 I think the second clause matches here (not the fi
54 //
55 // const std::nullptr_t nullptr;
56 nullptr_t() { }
57
52 // Make nullptr convertible to any pointer type. 58 // Make nullptr convertible to any pointer type.
53 template<typename T> operator T*() const { return 0; } 59 template<typename T> operator T*() const { return 0; }
54 // Make nullptr convertible to any member pointer type. 60 // Make nullptr convertible to any member pointer type.
55 template<typename C, typename T> operator T C::*() { return 0; } 61 template<typename C, typename T> operator T C::*() { return 0; }
56 private: 62 private:
57 // Do not allow taking the address of nullptr. 63 // Do not allow taking the address of nullptr.
58 void operator&(); 64 void operator&();
59 }; 65 };
60 } 66 }
61 WTF_EXPORT extern const std::nullptr_t nullptr; 67 WTF_EXPORT extern const std::nullptr_t nullptr;
(...skipping 10 matching lines...) Expand all
72 #else 78 #else
73 #define WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(ClassName) \ 79 #define WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(ClassName) \
74 private: \ 80 private: \
75 ClassName(int) 81 ClassName(int)
76 #define WTF_DISALLOW_ZERO_ASSIGNMENT(ClassName) \ 82 #define WTF_DISALLOW_ZERO_ASSIGNMENT(ClassName) \
77 private: \ 83 private: \
78 ClassName& operator=(int) 84 ClassName& operator=(int)
79 #endif 85 #endif
80 86
81 #endif 87 #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