Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
construct.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Copyright (C) 1997-2024 by Dimitri van Heesch.
4
*
5
* Permission to use, copy, modify, and distribute this software and its
6
* documentation under the terms of the GNU General Public License is hereby
7
* granted. No representations are made about the suitability of this software
8
* for any purpose. It is provided "as is" without express or implied warranty.
9
* See the GNU General Public License for more details.
10
*
11
* Documents produced by Doxygen are derivative works derived from the
12
* input used in their production; they are not affected by this license.
13
*
14
*/
15
16
#ifndef CONSTRUCT_H
17
#define CONSTRUCT_H
18
19
//! Macro to implement rule of 5 for an abstract base class
20
#define ABSTRACT_BASE_CLASS(cls) \
21
cls() = default; \
22
cls(const cls &) = delete; \
23
cls &operator=(const cls &) = delete; \
24
cls(cls &&) = delete; \
25
cls &operator=(cls &&) = delete; \
26
virtual ~cls() = default; \
27
28
//! Macro to help implementing the rule of 5 for a default copyable & movable class
29
#define DEFAULT_COPYABLE(cls) \
30
cls(const cls &) = default; \
31
cls &operator=(const cls &) = default; \
32
cls(cls &&) = default; \
33
cls &operator=(cls &&) = default; \
34
virtual ~cls() = default;
35
36
//! Macro to help implementing the rule of 5 for a non-copyable & movable class
37
#define NON_COPYABLE(cls) \
38
cls(const cls &) = delete; \
39
cls &operator=(const cls &) = delete; \
40
cls(cls &&) = delete; \
41
cls &operator=(cls &&) = delete; \
42
43
//! Macro to help implementing the rule of 5 for a class that can be moved but not copied
44
#define ONLY_DEFAULT_MOVABLE(cls) \
45
cls(const cls &) = delete; \
46
cls &operator=(const cls &) = delete; \
47
cls(cls &&) = default; \
48
cls &operator=(cls &&) = default; \
49
50
#define ONLY_MOVABLE_DECL(cls) \
51
cls(const cls &) = delete; \
52
cls &operator=(const cls &) = delete; \
53
cls(cls &&); \
54
cls &operator=(cls &&); \
55
56
#define DEFAULT_MOVABLE_IMPL(cls) \
57
cls::cls(cls &&) = default; \
58
cls &cls::operator=(cls &&) = default; \
59
60
#endif
src
construct.h
Generated by
1.17.0