Re: [Boost-bugs] [Boost C++ Libraries] #5741: Declare sequence_index as non-copyable

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5741: Declare sequence_index as non-copyable
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-07-31 06:36:17


#5741: Declare sequence_index as non-copyable
-----------------------------------------------------+----------------------
  Reporter: Maxime van Noppen <maxime@…> | Owner: joaquin
      Type: Feature Requests | Status: new
 Milestone: To Be Determined | Component: multi_index
   Version: Boost 1.47.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------------+----------------------

Comment (by Michel MORIN <mimomorin@…>):

 A patch attached, and here is a test case:

 {{{
 #include <iostream>

 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/ordered_index.hpp>
 #include <boost/multi_index/random_access_index.hpp>
 #include <boost/multi_index/sequenced_index.hpp>

 #include <boost/foreach.hpp>
 #include <boost/range/value_type.hpp>

 template <typename Range>
 void display_range(Range const& rng)
 {
     BOOST_FOREACH(typename boost::range_value<Range>::type x, rng) {
         std::cout << x << std::endl;
     }
 }

 int main (int argc, char* argv[])
 {
     using namespace boost::multi_index;

     multi_index_container<int, indexed_by<
         hashed_unique<identity<int> >
       , hashed_non_unique<identity<int> >
       , ordered_unique<identity<int> >
       , ordered_non_unique<identity<int> >
       , random_access<>
       , sequenced<>
> > cont;

     display_range(cont.get<0>());
     display_range(cont.get<1>());
     display_range(cont.get<2>());
     display_range(cont.get<3>());
     display_range(cont.get<4>());
     display_range(cont.get<5>());

     return 0;
 }
 }}}

 Without the patch, this test fails to compile on compilers that use
 `BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION`
 , such as gcc-4.6 and clang (both in C++03 mode).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5741#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC