Ring Daemon 16.0.0
Loading...
Searching...
No Matches
noncopyable.h File Reference

Simple macro to hide class' copy constructor and assignment operator. More...

Go to the source code of this file.

Macros

#define NON_COPYABLE(ClassName)
 

Detailed Description

Simple macro to hide class' copy constructor and assignment operator.

Useful to avoid shallow copying (i.e. classes with pointer members) Usage: For a class named MyClass, the macro call NON_COPYABLE(MyClass) should go in the private section of MyClass WARNING: Since C++11 using this macro make the class also non-movable by default! You shall re-implement yourself (or at least using declare with =default) move-constructor and move-assignable function members if they are needed.

Definition in file noncopyable.h.

Macro Definition Documentation

◆ NON_COPYABLE

#define NON_COPYABLE (   ClassName)
Value:
ClassName(const ClassName&) = delete; \
ClassName& operator=(const ClassName&) = delete

Definition at line 30 of file noncopyable.h.