
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 07 August 2008 09:36 am, Frank Mori Hess wrote:
Couldn't you use lambda for this?
boost::shared_ptr<int> s; { int sockfd = socket(PF_INET,SOCK_STREAM,0); if( sockfd!=-1 ) s.reset(&sockfd, boost::lambda::bind(close, * boost::lambda::_1)); }
I've never really used lambda, but it compiles at least. By the way, is there any documentation on the lambda headers (which ones to include to use what)? I didn't see anything in the lambda docs.
Err, nevermind. This will fail when sockfd goes out of scope. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFImvwp5vihyNWuA4URAh67AJ9WC+46DseGcxkQrGHZ1due9qRwngCeLE9e MzyY8PLrawS+fsHXDidka7o= =QFKh -----END PGP SIGNATURE-----