Files
INS-VN-200/vnproglib/cpp/include/vn/nocopy.h
r.koeppe 2d22ccd2d6 initial
2024-05-14 02:14:13 +02:00

46 lines
820 B
C++

/// \file
/// {COMMON_HEADER}
#ifndef _VNUTIL_NOCOPY_H_
#define _VNUTIL_NOCOPY_H_
#include "export.h"
namespace vn {
namespace util {
/// \brief Identifies a derived class as being unable to be copied and prevents
/// copy attempts.
///
/// Example for making derived objects uncopyable.
/// \code
/// class MyClass : private NoCopy
/// {
/// // Class implementation.
/// }
/// \endcode
class vn_proglib_DLLEXPORT NoCopy
{
protected:
/// \brief Allows construction of derived objects.
NoCopy() { }
/// \brief Allows destruction of derived objects.
~NoCopy() { }
private:
/// \brief Prevent copying of derived objects.
NoCopy(const NoCopy&);
/// \brief Prevent assignment copying of derived objects.
NoCopy& operator=(const NoCopy&);
};
}
}
#endif