Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-08-14 17:30:10


AMDG

I vote to accept ScopeExit into boost.

As has already been mentioned you need
to use __COUNT__ instead of __LINE__
for msvc.

BOOST_SCOPE_EXIT_FASTER_IMPL is slower under
msvc 8.0

#include <iostream>
#include <boost/scope_exit.hpp>
#include <boost/timer.hpp>

int main() {
    boost::timer timer;
    for(int i = 0; i < 100000000; ++i) {
        int j = 0;
        BOOST_SCOPE_EXIT((j)) {
            ++j;
        }
        BOOST_SCOPE_EXIT_END;
    }
    std::cout << timer.elapsed() << std::endl;
}

This takes .718 seconds with BOOST_SCOPE_EXIT_FASTER_IMPL
and .484 seconds without it.
 
I think that you should remove this
option since it doesn't do any good.

BOOST_SCOPE_EXIT_TRY/BOOST_SCOPE_EXIT_CATCH_ALL: I do
not think that these macros are useful. If I want to
catch all the exceptions then I can just put try/catch
in myself. There is no need to have an extra pair of
macros to do it for me.

boost_scope_exit_params_struct_nn needs to declare an assignment operator
to suppress warning C4512: 'main::boost_scope_exit_params_struct_20' :
assignment operator could not be generated.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk