Deletes copy constructor and assignment operator in Singleton class, fixes #3

This commit is contained in:
Jakub Vojvoda
2019-05-24 16:22:47 +02:00
parent 7c8a9e150f
commit 207e6f909c

View File

@@ -18,6 +18,15 @@
class Singleton
{
public:
// The copy constructor and assignment operator
// are defined as deleted, which means that you
// can't make a copy of singleton.
//
// Note: you can achieve the same effect by declaring
// the constructor and the operator as private
Singleton( Singleton const& ) = delete;
Singleton& operator=( Singleton const& ) = delete;
static Singleton* get()
{
if ( !instance )