Boost C++ Libraries: Ticket #4720: [function][patch] function wrapper with no exception safety guarantee https://svn.boost.org/trac10/ticket/4720 <p> boost::function provides a strong exception safety guarantee. However, in certain circumstances, such as some embedded systems, no exception safety guarantee is desirable. I request that function object wrappers with no exception safety guarantee be added to the Boost.Function family. The attached patch implements boost::unsafe_function (with both preferred syntax and portable syntax), which has no exception safety guarantee when invoked with no target and has no dependency on boost::throw_exception. The patch includes tests and documentation updates. It addresses the same issue identified in <a class="new ticket" href="https://svn.boost.org/trac10/ticket/4646" title="#4646: Feature Requests: [function][patch] adding an unchecked_invoke method to function objects (new)">#4646</a>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4720 Trac 1.4.3 Daniel Walker Thu, 07 Oct 2010 19:12:57 GMT attachment set https://svn.boost.org/trac10/ticket/4720 https://svn.boost.org/trac10/ticket/4720 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">djw_unsafe_function.patch</span> </li> </ul> <p> Implements boost::unsafe_function with tests and docs. </p> Ticket peter.myerscough-jackopson@… Fri, 08 Oct 2010 08:14:23 GMT <link>https://svn.boost.org/trac10/ticket/4720#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4720#comment:1</guid> <description> <p> I like the concept of an entirely separate <em>unsafe_function</em>, but I am also aware that the patch of <a class="new ticket" href="https://svn.boost.org/trac10/ticket/4646" title="#4646: Feature Requests: [function][patch] adding an unchecked_invoke method to function objects (new)">#4646</a> would also enable benefits when the normal function object is used, for example a common idiom of using function objects is </p> <pre class="wiki">if( funcObj ) { funcObj(); // could be funcObj-&gt;unchecked_invoke(); } </pre><p> which would benefit from being an unchecked_invoke(), but I suppose that it may be simpler / cleaner to maintain the calling operator and allow an optimizer to remove the repeated checking of the funcObj's validity, but this does rely on the optimiser, which both gcc and msvc++ do. </p> <p> I think it would be worth placing some boost assertions in place of the previous checks so that debug code will catch and highlight the failure point. </p> </description> <category>Ticket</category> </item> </channel> </rss>