All pastes #1034439 Raw Edit

Mine

public cpp v1 · immutable
#1034439 ·published 2008-05-30 21:45 UTC
rendered paste body
// nowint main() {	ConnectionManager mgr;	ClientConnection* client = mgr.connect("localhost");	//do stuff with client	return 0;	//when mgr is implicitly destructed here, all the client connections are	//freed}//similar to asioint main() {	ConnectionManager mgr;	//in theory then I don't need a pointer, the app can create a	//ClientConnection in the stack, the heap, with a smart pointer, whatever.	ClientConnection client(mgr, "localhost");	//do stuff with client	return 0;	//here both client and mgr will be implicitly destructed (client first)}