QNLP  v1.0
Singleton.hpp
Go to the documentation of this file.
1 
9 namespace QNLP{
10 
15 class Singleton{
16  private:
17 
22  Singleton() = default;
23 
28  virtual ~Singleton() = default;
29 
30  public:
31 
36  Singleton(const Singleton&) = delete;
37 
42  Singleton(Singleton&&) = delete;
43 
49  Singleton& operator=(const Singleton&) = delete;
50 
56  Singleton& operator=(Singleton&&) = delete;
57 
64  static Singleton s;
65  return s;
66  }
67 
68 };
69 
70 };
Follows the Meyers singleton pattern, allowing thread-safe access to singleton object.
Definition: Singleton.hpp:15
virtual ~Singleton()=default
Destroy the Singleton object.
Singleton & operator=(const Singleton &)=delete
Overloaded = (disabled)
static Singleton & getInstance()
Get the Instance object.
Definition: Singleton.hpp:63
Singleton()=default
Construct a new Singleton object.