Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 207e6f9

Browse filesBrowse files
committed
Deletes copy constructor and assignment operator in Singleton class, fixes #3
1 parent 7c8a9e1 commit 207e6f9
Copy full SHA for 207e6f9

File tree

Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Open diff view settings
Collapse file

‎singleton/Singleton.cpp‎

Copy file name to clipboardExpand all lines: singleton/Singleton.cpp
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818
class Singleton
1919
{
2020
public:
21+
// The copy constructor and assignment operator
22+
// are defined as deleted, which means that you
23+
// can't make a copy of singleton.
24+
//
25+
// Note: you can achieve the same effect by declaring
26+
// the constructor and the operator as private
27+
Singleton( Singleton const& ) = delete;
28+
Singleton& operator=( Singleton const& ) = delete;
29+
2130
static Singleton* get()
2231
{
2332
if ( !instance )

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.