Created
March 2, 2017 21:43
-
-
Save Asher-/a8d31c619c7652fc931301ad11262a36 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| template | |
| < | |
| typename Type | |
| > | |
| class ReseatableReference | |
| { | |
| public: | |
| ReseatableReference ( const Type& reference ) : reference( reference ) {}; | |
| void set( const Type& reference ) { ~ReseatableReference(); new (this) ReseatableReference( reference ); } | |
| Type& operator()() { return reference; }; | |
| operator Type&() { return reference; }; | |
| const Type& reference; | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment