Created
November 11, 2011 01:10
-
-
Save afeinberg/1356822 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
void x() { | |
SomeClass blah; | |
asyncthread(y(blah)); | |
} | |
// Note if you pass shit by reference, it should be a const reference. Otherwise just use a pointer | |
void y(const SomeClass &blah) { | |
Blah blah_copy(blah); // <-- assuming the constructor does not do a shallow copy | |
} | |
// This is how I'd design it | |
void x() { | |
shared_ptr<SomeClass> blah(new SomeClass); | |
asyncthread(y(blah))); | |
} | |
void y(const shared_ptr<SomeClass> &blah) { | |
doShit(*blah); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment