Boost C++ Libraries: Ticket #736: Const correctness violation https://svn.boost.org/trac10/ticket/736 <pre class="wiki"> Boost.Function does not preserve const correctness for reference wrappers e.g. class function_object_type { public: void operator()() const {} }; void f() { const function_object_type const_function_object; boost::function&lt;void()&gt; function(boost::ref(const_function_object)); assert(function.target&lt;function_object&gt;() == &amp;const_function_object); //const lost } I can see two possible solutions for this: add a flag: enum cv_qualifiers { const_ = 1, volatile_ = 1 &lt;&lt; 1}; or don't unwrap references for target: function.target&lt;boost::reference_wrapper&lt;function_object&gt; &gt;() The first method seems preferable because it doesn't require the interface to change. In Christ, Steven Watanabe </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/736 Trac 1.4.3 Marshall Clow Thu, 12 Jul 2007 15:15:21 GMT owner, status changed; severity set https://svn.boost.org/trac10/ticket/736#comment:1 https://svn.boost.org/trac10/ticket/736#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Douglas Gregor</span> to <span class="trac-author">doug_gregor</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> <p> Assigned to "doug_gregor" instead of nonexistent user "dgregor" </p> Ticket Douglas Gregor Thu, 13 Sep 2007 18:23:52 GMT owner, status, description changed https://svn.boost.org/trac10/ticket/736#comment:2 https://svn.boost.org/trac10/ticket/736#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">doug_gregor</span> to <span class="trac-author">Douglas Gregor</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/736?action=diff&amp;version=2">diff</a>) </li> </ul> Ticket Douglas Gregor Fri, 05 Sep 2008 17:52:14 GMT status, resolution changed https://svn.boost.org/trac10/ticket/736#comment:3 https://svn.boost.org/trac10/ticket/736#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/48618" title="Make Boost.Function's target() operation respect the cv-qualifiers of ...">[48618]</a>) Make Boost.Function's target() operation respect the cv-qualifiers of referenced function objects. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/736" title="#736: Bugs: Const correctness violation (closed: fixed)">#736</a> </p> Ticket