Boost C++ Libraries: Ticket #3044: mpl::aux_::iter_fold_if_impl allows deref l_end https://svn.boost.org/trac10/ticket/3044 <p> The mpl::aux_::iter_fold_if_impl template: </p> <blockquote> <p> <a class="ext-link" href="https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/aux"><span class="icon">​</span>https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/aux</a>_ </p> <blockquote> <p> /iter_fold_if_impl.hpp </p> </blockquote> </blockquote> <p> allows deref'ing of an end iterator. The problem is most easily shown with list because deref&lt;l_end&gt; is not possible. Apparently, deref of an end iterator from other sequences (e.g. vector or range_c) allow deref of an end iterator. </p> <p> The attached: </p> <blockquote> <p> iter_fold_if_bkprotect.zip </p> </blockquote> <p> illustrates the problem. The attached: </p> <blockquote> <p> iter_fold_if_bkprotect2.zip </p> </blockquote> <p> illustrates the cause. The attached: </p> <blockquote> <p> while.cpp </p> </blockquote> <p> illustrates a solution. However, the while.cpp suffers from the template instantiation depth problem described here: </p> <blockquote> <p> <a class="ext-link" href="http://www.mywikinet.com/mpl/paper"><span class="icon">​</span>http://www.mywikinet.com/mpl/paper</a> </p> <blockquote> <p> /mpl_paper.html#sequences.unrolling </p> </blockquote> </blockquote> <p> More (*maybe* helpful) details can be found at the following boost ml thread: </p> <blockquote> <p> <a class="ext-link" href="http://thread.gmane.org/gmane.comp.lib.boost.devel/187289"><span class="icon">​</span>http://thread.gmane.org/gmane.comp.lib.boost.devel/187289</a> </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3044 Trac 1.4.3 cppljevans@… Mon, 18 May 2009 16:07:52 GMT attachment set https://svn.boost.org/trac10/ticket/3044 https://svn.boost.org/trac10/ticket/3044 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">iter_fold_if_bkprotect.zip</span> </li> </ul> <p> shows bug </p> Ticket cppljevans@… Mon, 18 May 2009 16:09:09 GMT attachment set https://svn.boost.org/trac10/ticket/3044 https://svn.boost.org/trac10/ticket/3044 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">iter_fold_if_bkprotect2.zip</span> </li> </ul> <p> shows bug cause </p> Ticket cppljevans@… Mon, 18 May 2009 16:10:34 GMT attachment set https://svn.boost.org/trac10/ticket/3044 https://svn.boost.org/trac10/ticket/3044 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">while.cpp</span> </li> </ul> <p> possible solution </p> Ticket Steven Watanabe Mon, 18 May 2009 19:31:00 GMT component changed; owner set https://svn.boost.org/trac10/ticket/3044#comment:1 https://svn.boost.org/trac10/ticket/3044#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Aleksey Gurtovoy</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">mpl</span> </li> </ul> Ticket Steven Watanabe Mon, 18 May 2009 22:27:59 GMT <link>https://svn.boost.org/trac10/ticket/3044#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3044#comment:2</guid> <description> <p> Patch attached. The reverse predicate doesn't add any significant functionality, and complicates the implementation, so I removed it entirely. Since iter_fold_if with a reverse operation doesn't work currently, this shouldn't break existing code. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Mon, 18 May 2009 22:28:54 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/3044 https://svn.boost.org/trac10/ticket/3044 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">iter_fold_if.patch</span> </li> </ul> Ticket cppljevans@… Fri, 05 Jun 2009 15:43:11 GMT attachment set https://svn.boost.org/trac10/ticket/3044 https://svn.boost.org/trac10/ticket/3044 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">while_recur.cpp</span> </li> </ul> <p> while.cpp replacement: while_recur (no unroll) while_unroll_recur(does unrolling) </p> Ticket cppljevans@… Fri, 05 Jun 2009 15:44:00 GMT attachment set https://svn.boost.org/trac10/ticket/3044 https://svn.boost.org/trac10/ticket/3044 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">while_recur.2.cpp</span> </li> </ul> <p> while.cpp replacement: while_recur (no unroll) while_unroll_recur(does unrolling) </p> Ticket cppljevans@… Sat, 06 Jun 2009 11:07:10 GMT <link>https://svn.boost.org/trac10/ticket/3044#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3044#comment:3</guid> <description> <p> Please ignore attachment, while_recur.2.cpp. It's just an accidental copy of while_recur.cpp. </p> <p> While_recur.cpp is essentially the while.cpp attachment with template, while_recur, as a renamed while_ of the while.cpp attachment. ALso while_recur.cpp has the while_unroll_recur template which is an "unrolled" (to lessen the template instantiation depth problem mentioned in comments) version of while_recur. The macro, USE_WHILE_UNROLL, decides whether while_recur or while_unroll_recur is used. </p> </description> <category>Ticket</category> </item> </channel> </rss>