OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BASE_MACROS_H_ | 5 #ifndef V8_BASE_MACROS_H_ |
6 #define V8_BASE_MACROS_H_ | 6 #define V8_BASE_MACROS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 template <class Dest, class Source> | 221 template <class Dest, class Source> |
222 V8_INLINE Dest bit_cast(Source const& source) { | 222 V8_INLINE Dest bit_cast(Source const& source) { |
223 COMPILE_ASSERT(sizeof(Dest) == sizeof(Source), VerifySizesAreEqual); | 223 COMPILE_ASSERT(sizeof(Dest) == sizeof(Source), VerifySizesAreEqual); |
224 | 224 |
225 Dest dest; | 225 Dest dest; |
226 memcpy(&dest, &source, sizeof(dest)); | 226 memcpy(&dest, &source, sizeof(dest)); |
227 return dest; | 227 return dest; |
228 } | 228 } |
229 | 229 |
230 | 230 |
| 231 // Put this in the private: declarations for a class to be unassignable. |
| 232 #define DISALLOW_ASSIGN(TypeName) void operator=(const TypeName&) |
| 233 |
| 234 |
231 // A macro to disallow the evil copy constructor and operator= functions | 235 // A macro to disallow the evil copy constructor and operator= functions |
232 // This should be used in the private: declarations for a class | 236 // This should be used in the private: declarations for a class |
233 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | 237 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
234 TypeName(const TypeName&) V8_DELETE; \ | 238 TypeName(const TypeName&) V8_DELETE; \ |
235 void operator=(const TypeName&) V8_DELETE | 239 void operator=(const TypeName&) V8_DELETE |
236 | 240 |
237 | 241 |
238 // A macro to disallow all the implicit constructors, namely the | 242 // A macro to disallow all the implicit constructors, namely the |
239 // default constructor, copy constructor and operator= functions. | 243 // default constructor, copy constructor and operator= functions. |
240 // | 244 // |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 417 } |
414 | 418 |
415 template <> | 419 template <> |
416 inline bool is_fundamental<uint8_t>() { | 420 inline bool is_fundamental<uint8_t>() { |
417 return true; | 421 return true; |
418 } | 422 } |
419 } | 423 } |
420 } // namespace v8::base | 424 } // namespace v8::base |
421 | 425 |
422 #endif // V8_BASE_MACROS_H_ | 426 #endif // V8_BASE_MACROS_H_ |
OLD | NEW |