Scope(exit) has been recently added to Boost 1.38

The Anh Tran trtheanh at gmail.com
Mon Mar 2 23:33:28 PST 2009


http://www.boost.org/doc/libs/1_38_0/libs/scope_exit/doc/html/scope_exit/alternatives.html

try
{
     File passwd("/etc/passwd");
     BOOST_SCOPE_EXIT( (&passwd) )
     {
         passwd.close();
     } BOOST_SCOPE_EXIT_END
     // ...
}
catch(...)
{
     log("could not get user info");
     throw;
}



More information about the Digitalmars-d mailing list