Boost C++ Libraries: Ticket #5096: display_expr is noncopyable https://svn.boost.org/trac10/ticket/5096 <p> proto::functional::display_expr is not copyable. This can trigger hard errors inside Fusion when being passed to fusion::for_each as a functor because Fusion may expect functors to be copyable. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5096 Trac 1.4.3 Eric Niebler Thu, 20 Jan 2011 03:09:24 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5096#comment:1 https://svn.boost.org/trac10/ticket/5096#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> It's noncopyable by design. This function object maintains state. Using copies will give erratic results. </p> Ticket Eric Niebler Thu, 20 Jan 2011 04:06:24 GMT resolution changed https://svn.boost.org/trac10/ticket/5096#comment:2 https://svn.boost.org/trac10/ticket/5096#comment:2 <ul> <li><strong>resolution</strong> <span class="trac-field-old">invalid</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/68314" title="display_expr is copyable, fixes #5096">[68314]</a>) display_expr is copyable, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5096" title="#5096: Bugs: display_expr is noncopyable (closed: fixed)">#5096</a> </p> Ticket Christopher Schmidt Sat, 22 Jan 2011 21:13:56 GMT <link>https://svn.boost.org/trac10/ticket/5096#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5096#comment:3</guid> <description> <p> Strictly speaking, <a class="changeset" href="https://svn.boost.org/trac10/changeset/68314" title="display_expr is copyable, fixes #5096">[68314]</a> defers the problem to detail::display_expr_impl, which is passed to fusion::for_each in display_expr_impl::impl although it is noncopyable. This is fine for now as Fusion passes around functors by const reference although the documentation states the opposite. </p> <p> <a class="ext-link" href="https://github.com/ryppl/boost-svn/blob/fad63fe4389e8a46e8ea9183eae46e401ea4bb6f/boost/fusion/algorithm/iteration/for_each.hpp"><span class="icon">​</span>https://github.com/ryppl/boost-svn/blob/fad63fe4389e8a46e8ea9183eae46e401ea4bb6f/boost/fusion/algorithm/iteration/for_each.hpp</a> <a href="http://www.boost.org/doc/libs/1_45_0/libs/fusion/doc/html/fusion/algorithm/iteration/functions/for_each.html">http://www.boost.org/doc/libs/1_45_0/libs/fusion/doc/html/fusion/algorithm/iteration/functions/for_each.html</a> </p> <p> AFAIK Fusion's current implementation is plain wrong. Functors should never be passed around by const reference. IIRC that's due to a defect in C++98. </p> <p> Anyway, wontfix/invalid is fine for me for now. I will try to propose a patch for fusion that removes const/reference qualifiers on functors and adds support for reference wrappers. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Mon, 24 Jan 2011 04:34:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5096#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5096#comment:4</guid> <description> <p> Ah, I see. I overlooked that fact that <code>display_expr_impl</code> was invoking <code>fusion::for_each</code>. Well, that's an internal detail of <code>display_expr</code> and can be easily changed. At least my change benefits others who want to pass <code>disply_expr</code> around by value. </p> </description> <category>Ticket</category> </item> </channel> </rss>