Skip to content

Instantly share code, notes, and snippets.

@dobrokot
Created April 10, 2012 22:26
Show Gist options
  • Save dobrokot/2355107 to your computer and use it in GitHub Desktop.
Save dobrokot/2355107 to your computer and use it in GitHub Desktop.
#include <boost/shared_ptr.hpp>
#include <iostream>
struct T {
boost::shared_ptr<MayBe<T> > next;
int i;
T() { i = 10; }
};
int main() {
MayBe<T> x(MayBeDefault);
x->next.reset(new MayBe<T>(MayBeDefault));
x = *x->next;
std::cout << x->i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment