OK, so if I use the RAII idiom to control some context attribute *, will it work as I expect if I use it at the beginning of the block try?
In other words, if I have this:
struct raii {
raii() {
std::cout << "Scope init"
<< std::endl; }
~raii() {
std::cout << "Scope exit"
<< std::endl; }
};
... and I successfully use it as follows:
{
raii do_the_raii_thing;
stuff_expecting_raii_context();
}
... will an RAII instance work in the same way if I do this:
try {
raii do_the_raii_thing;
stuff_expecting_raii_context_that_might_throw();
} catch (std::exception const&) {
}
This is probably a stupid question, but I want to check my own sanity about this - I do not clearly understand the intricacies of guarantees noexceptand other exceptions related to exceptions - so I apologize for my naive
[*] , Python C-APIs GIL ( ), RAII,