Boost C++ Libraries: Ticket #5741: Declare sequence_index as non-copyable https://svn.boost.org/trac10/ticket/5741 <p> Based on this thread : <a class="ext-link" href="http://lists.boost.org/boost-users/2011/07/69718.php"><span class="icon">​</span>http://lists.boost.org/boost-users/2011/07/69718.php</a> </p> <p> sequence_index should be declared as non-copyable to allow BOOST_FOREACH to iterate over it. </p> <p> Michel Morin gave a solution: <a class="ext-link" href="http://lists.boost.org/boost-users/2011/07/69722.php"><span class="icon">​</span>http://lists.boost.org/boost-users/2011/07/69722.php</a> </p> <pre class="wiki">namespace boost { namespace foreach { template&lt;typename SuperMeta,typename TagList&gt; struct is_noncopyable&lt; boost::multi_index::detail::sequenced_index&lt;SuperMeta, TagList&gt; &gt; : mpl::true_ {}; } } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5741 Trac 1.4.3 Michel MORIN <mimomorin@…> Sat, 30 Jul 2011 13:14:32 GMT <link>https://svn.boost.org/trac10/ticket/5741#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5741#comment:1</guid> <description> <p> Follow up: </p> <p> The fix (to tell <code>BOOST_FOREACH</code> to avoid coping <code>sequenced_index</code>) needs forward declaration of <code>foreach::is_noncopyable</code>. </p> <pre class="wiki">namespace boost{ namespace foreach{ template&lt;typename T&gt; struct is_noncopyable; // forward declaration template&lt;typename SuperMeta,typename TagList&gt; struct is_noncopyable&lt; multi_index::detail::sequenced_index&lt;SuperMeta, TagList&gt; &gt;:mpl::true_ { }; }} </pre> </description> <category>Ticket</category> </item> <item> <author>Michel MORIN <mimomorin@…></author> <pubDate>Sat, 30 Jul 2011 13:16:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5741#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5741#comment:2</guid> <description> <p> Other index types (<code>ordered_index</code>, <code>hashed_index</code>, <code>random_access_index</code>) also need this fix. </p> </description> <category>Ticket</category> </item> <item> <author>Michel MORIN <mimomorin@…></author> <pubDate>Sun, 31 Jul 2011 06:34:31 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/5741 https://svn.boost.org/trac10/ticket/5741 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">multi_index_foreach_support_fix.patch</span> </li> </ul> <p> A patch for <code>hashed_index</code>, <code>ordered_index</code>, <code>random_access_index</code> and <code>sequenced_index</code> (against trunk). </p> Ticket Michel MORIN <mimomorin@…> Sun, 31 Jul 2011 06:36:17 GMT <link>https://svn.boost.org/trac10/ticket/5741#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5741#comment:3</guid> <description> <p> A patch attached, and here is a test case: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/multi_index_container.hpp&gt; #include &lt;boost/multi_index/hashed_index.hpp&gt; #include &lt;boost/multi_index/ordered_index.hpp&gt; #include &lt;boost/multi_index/random_access_index.hpp&gt; #include &lt;boost/multi_index/sequenced_index.hpp&gt; #include &lt;boost/foreach.hpp&gt; #include &lt;boost/range/value_type.hpp&gt; template &lt;typename Range&gt; void display_range(Range const&amp; rng) { BOOST_FOREACH(typename boost::range_value&lt;Range&gt;::type x, rng) { std::cout &lt;&lt; x &lt;&lt; std::endl; } } int main (int argc, char* argv[]) { using namespace boost::multi_index; multi_index_container&lt;int, indexed_by&lt; hashed_unique&lt;identity&lt;int&gt; &gt; , hashed_non_unique&lt;identity&lt;int&gt; &gt; , ordered_unique&lt;identity&lt;int&gt; &gt; , ordered_non_unique&lt;identity&lt;int&gt; &gt; , random_access&lt;&gt; , sequenced&lt;&gt; &gt; &gt; cont; display_range(cont.get&lt;0&gt;()); display_range(cont.get&lt;1&gt;()); display_range(cont.get&lt;2&gt;()); display_range(cont.get&lt;3&gt;()); display_range(cont.get&lt;4&gt;()); display_range(cont.get&lt;5&gt;()); return 0; } </pre><p> Without the patch, this test fails to compile on compilers that use <code>BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION</code> , such as gcc-4.6 and clang (both in C++03 mode). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joaquín M López Muñoz</dc:creator> <pubDate>Wed, 03 Aug 2011 06:31:30 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5741#comment:4 https://svn.boost.org/trac10/ticket/5741#comment:4 <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">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/73498" title="fixed #5741">[73498]</a>) fixed <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5741" title="#5741: Feature Requests: Declare sequence_index as non-copyable (closed: fixed)">#5741</a> </p> Ticket