
8 Aug
2008
8 Aug
'08
1:02 p.m.
Frank Mori Hess wrote:
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.
boost::shared_ptr<void> s; { int sockfd = socket(PF_INET, SOCK_STREAM, 0); if( sockfd != -1) s.reset(static_cast<void*>(sockfd), bind(close, static_cast_<int>(_1))); }