| // Copyright 2010 The Goma Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| |
| #ifndef DEVTOOLS_GOMA_BASE_BASICTYPES_H_ |
| #define DEVTOOLS_GOMA_BASE_BASICTYPES_H_ |
| |
| // Put this in the private: declarations for a class to be uncopyable. |
| #define DISALLOW_COPY(TypeName) \ |
| TypeName(const TypeName&) = delete; |
| |
| // Put this in the private: declarations for a class to be unassignable. |
| #define DISALLOW_ASSIGN(TypeName) \ |
| void operator=(const TypeName&) = delete; |
| |
| // A macro to disallow the copy constructor and operator= functions |
| // This should be used in the private: declarations for a class |
| #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
| TypeName(const TypeName&) = delete; \ |
| void operator=(const TypeName&) = delete; |
| |
| // A macro to disallow all the implicit constructors, namely the |
| // default constructor, copy constructor and operator= functions. |
| // |
| // This should be used in the private: declarations for a class |
| // that wants to prevent anyone from instantiating it. This is |
| // especially useful for classes containing only static methods. |
| #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ |
| TypeName() = delete; \ |
| DISALLOW_COPY_AND_ASSIGN(TypeName); |
| |
| #endif // DEVTOOLS_GOMA_BASE_BASICTYPES_H_ |