Is it abusive to implement the "execute-around" idiom with scoped objects?
<p>Should scoped objects (with complimentary logic implemented in constructor and destructor) only be used for resource cleanup (RAII)?</p>

<p>Or can I use it to implement certain aspects of the application's logic?</p>

<p>A while ago I asked about <a href="http://stackoverflow.com/questions/7743771/function-hooking-in-c">Function hooking in C++</a>. It turns out that <a href="http://www2.research.att.com/~bs/wrapper.pdf" rel="nofollow">Bjarne addressed this problem</a> and the solution he proposes is to create a proxy object that implements <code>operator-&gt;</code> and allocates a scoped object there. The "before" and "after" are implemented in the scoped object's constructor and destructor respectively.</p>

<p>The problem is that destructors should not throw. So you have to wrap the destructor in a <code>try { /* ... */ } catch(...) { /*empty*/ }</code> block. This severely limits the ability to handle errors in the "after" code.</p>

<p>Should scoped objects only be used to cleanup resources or can I use it for more than that? Where do I draw the line?</p>
