Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

copy_move.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 /* This needs to be synchronized with doc/ogdf-doxygen.cfg:EXPAND_AS_DEFINED */
35 
37 #define OGDF_NO_COPY(cls) \
38  cls(const cls& copy) = delete; \
39  cls& operator=(const cls& copy) = delete;
40 
42 #define OGDF_NO_MOVE(cls) \
43  cls(cls&& move) = delete; \
44  cls& operator=(cls&& move) = delete;
45 
47 #define OGDF_DEFAULT_COPY(cls) \
48  cls(const cls& copy) = default; \
49  cls& operator=(const cls& copy) = default;
50 
52 #define OGDF_DEFAULT_MOVE(cls) \
53  cls(cls&& move) noexcept = default; \
54  cls& operator=(cls&& move) noexcept = default;
55 
57 #define OGDF_COPY_CONSTR(cls) cls(const cls& copy)
58 #define OGDF_COPY_OP(cls) cls& operator=(const cls& copy)
60 #define OGDF_MOVE_CONSTR(cls) cls(cls&& move) noexcept : cls()
62 #define OGDF_MOVE_OP(cls) cls& operator=(cls&& move) noexcept
64 #define OGDF_SWAP_OP(cls) friend void swap(cls& first, cls& second) noexcept
66 
68 
76 #define OGDF_COPY_MOVE_BY_SWAP(cls) \
77  \
86  cls& operator=(cls copy_by_value) noexcept { \
87  swap(*this, copy_by_value); \
88  return *this; \
89  } \
90  OGDF_MOVE_CONSTR(cls) { swap(*this, move); }