Public Member Functions | List of all members
gar::UncopiableAndUnmovableClass Struct Reference

An empty class that can't be copied nor moved. More...

#include <UncopiableAndUnmovableClass.h>

Inheritance diagram for gar::UncopiableAndUnmovableClass:
MyProvider

Public Member Functions

 UncopiableAndUnmovableClass ()=default
 Default constructor. More...
 
 ~UncopiableAndUnmovableClass ()=default
 Default destructor. More...
 
 UncopiableAndUnmovableClass (UncopiableAndUnmovableClass const &)=delete
 Deleted copy and move constructors and assignments. More...
 
 UncopiableAndUnmovableClass (UncopiableAndUnmovableClass &&)=delete
 
UncopiableAndUnmovableClassoperator= (UncopiableAndUnmovableClass const &)=delete
 
UncopiableAndUnmovableClassoperator= (UncopiableAndUnmovableClass &&)=delete
 

Detailed Description

An empty class that can't be copied nor moved.


A class derived from this one can still be copied (or moved) with an explicit effort. For example, to enable copy construction:

struct CopiableClass: protected UncopiableAndUnmovableClass {
  CopiableClass(CopiableClass const& from)
    : UncopiableAndUnmovableClass() // , ...
    {
      // ...
    }
};

the default constructor of the base class can be called explicitly instead of the copy constructor. To provide an assignment operation,

struct MoveAssignableClass: protected UncopiableAndUnmovableClass {
  MoveAssignableClass& operator= (MoveAssignableClass&& from)
    {
      // ...
      return *this;
    }
};

Definition at line 43 of file UncopiableAndUnmovableClass.h.

Constructor & Destructor Documentation

gar::UncopiableAndUnmovableClass::UncopiableAndUnmovableClass ( )
default

Default constructor.

gar::UncopiableAndUnmovableClass::UncopiableAndUnmovableClass ( UncopiableAndUnmovableClass const &  )
delete

Deleted copy and move constructors and assignments.

gar::UncopiableAndUnmovableClass::UncopiableAndUnmovableClass ( UncopiableAndUnmovableClass &&  )
delete
gar::UncopiableAndUnmovableClass::~UncopiableAndUnmovableClass ( )
default

Default destructor.

Member Function Documentation

UncopiableAndUnmovableClass& gar::UncopiableAndUnmovableClass::operator= ( UncopiableAndUnmovableClass const &  )
delete
UncopiableAndUnmovableClass& gar::UncopiableAndUnmovableClass::operator= ( UncopiableAndUnmovableClass &&  )
delete

The documentation for this struct was generated from the following file: