Home | History | Annotate | Download | only in base
      1 // Copyright 2014 The Android Open Source Project
      2 //
      3 // This software is licensed under the terms of the GNU General Public
      4 // License version 2, as published by the Free Software Foundation, and
      5 // may be copied, distributed, and modified under those terms.
      6 //
      7 // This program is distributed in the hope that it will be useful,
      8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 // GNU General Public License for more details.
     11 
     12 #ifndef ANDROID_BASE_COMPILER_H
     13 #define ANDROID_BASE_COMPILER_H
     14 
     15 // Use this in the private section of a class declaration to ensure
     16 // that the corresponding objects cannot be copy-constructed or
     17 // assigned. For example:
     18 //
     19 //   class Foo {
     20 //   public:
     21 //       .... public declarations
     22 //   private:
     23 //       DISALLOW_COPY_AND_ASSIGN(Foo)
     24 //       .... other private declarations
     25 //   };
     26 //
     27 #define DISALLOW_COPY_AND_ASSIGN(T)  \
     28     T(const T& other); \
     29     T& operator=(const T& other)
     30 
     31 #endif  // ANDROID_BASE_COMPILER_H
     32