OLD | NEW |
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 Loading... |
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 in GCC 4.5, a la: |
| 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 Loading... |
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 |
OLD | NEW |