Created
September 4, 2018 13:18
-
-
Save carmel4a/3595e6469cdc60bc7e1fc16347a66d6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct A() | |
{ | |
A& get(); | |
int member; | |
private: | |
A(); | |
A& A( const A& ) = delete; | |
A& operator=( const A& ) = delete; | |
}; | |
A& A::get | |
{ | |
static A a; | |
return a; | |
} | |
int main() | |
{ | |
// mainloop | |
while( true ) | |
{ | |
A::get().member; | |
// ... | |
A::get().member; | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment