A Discrete-Event Network Simulator
API
ns3::NonCopyable Class Reference

A base class for (non-Singleton) objects which shouldn't be copied. More...

#include "non-copyable.h"

+ Inheritance diagram for ns3::NonCopyable:

Protected Member Functions

 NonCopyable ()
 Constructor. More...
 
 ~NonCopyable ()
 Destructor. More...
 

Private Member Functions

 NonCopyable (const NonCopyable &)
 Copy constructor. More...
 
NonCopyableoperator= (const NonCopyable &other)
 Assignment. More...
 

Detailed Description

A base class for (non-Singleton) objects which shouldn't be copied.

To prevent copying of your class ExampleNC just inherit from NonCopyable:

class ExampleNC : private NonCopyable { ... };

This class prevents each instance of a derived class from being copied. If you want only a single global instance of the derived class, see Singleton.

Internal:
This is based on boost::noncopyable.

Definition at line 54 of file non-copyable.h.

Constructor & Destructor Documentation

◆ NonCopyable() [1/2]

ns3::NonCopyable::NonCopyable ( )
inlineprotected

Constructor.

Definition at line 58 of file non-copyable.h.

◆ ~NonCopyable()

ns3::NonCopyable::~NonCopyable ( )
inlineprotected

Destructor.

Definition at line 60 of file non-copyable.h.

◆ NonCopyable() [2/2]

ns3::NonCopyable::NonCopyable ( const NonCopyable )
private

Copy constructor.

Private, so not copyable.

Member Function Documentation

◆ operator=()

NonCopyable& ns3::NonCopyable::operator= ( const NonCopyable other)
private

Assignment.

Private, so not copyable.

Parameters
[in]otherThe dummy argument
Returns
The unmodified copy.

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