blob: c234d40d7e2f4f58209d924115fb064b1bc6c1a8 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_CONSTRUCTORMAGIC_H_
12#define WEBRTC_BASE_CONSTRUCTORMAGIC_H_
13
henrikg3c089d72015-09-16 05:37:44 -070014#define RTC_DISALLOW_ASSIGN(TypeName) \
tommi9a78d222015-09-10 01:41:55 -070015 void operator=(const TypeName&)
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000016
tommi9a78d222015-09-10 01:41:55 -070017// A macro to disallow the evil copy constructor and operator= functions
18// This should be used in the private: declarations for a class.
henrikg3c089d72015-09-16 05:37:44 -070019#define RTC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
20 TypeName(const TypeName&); \
21 RTC_DISALLOW_ASSIGN(TypeName)
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000022
tommi9a78d222015-09-10 01:41:55 -070023// A macro to disallow all the implicit constructors, namely the
24// default constructor, copy constructor and operator= functions.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000025//
tommi9a78d222015-09-10 01:41:55 -070026// This should be used in the private: declarations for a class
27// that wants to prevent anyone from instantiating it. This is
28// especially useful for classes containing only static methods.
henrikg3c089d72015-09-16 05:37:44 -070029#define RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
30 TypeName(); \
31 RTC_DISALLOW_COPY_AND_ASSIGN(TypeName)
tommi9a78d222015-09-10 01:41:55 -070032
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000033#endif // WEBRTC_BASE_CONSTRUCTORMAGIC_H_