Boost logo

Boost Users :

From: Martin Eigel (martin_eigel_at_[hidden])
Date: 2006-02-15 15:37:22

Hi list,

I am encountering a problem with MultiIndex which can
be resolved by disabling SAFE_MODE. As I actually do
not get the problem in the code attached below I'd
like to ask for an explanation. The marked line of
code (i.e. the second iterator assignment) seems to be
responsible for blocking MultiIndex's dtor in

void detach_all_iterators()

Why is this and how can it correctly be avoided?


(boost 1.33.1, gcc 3.4.5)


#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>

using boost::multi_index_container;
using namespace boost::multi_index;

struct T1{};
struct T2{};

typedef int T;
typedef std::pair<T,T> value_type;

typedef multi_index_container<
  tag<T1>, member<value_type,T,&value_type::first> >,
  tag<T2>, member<value_type,T,&value_type::second> >
> > miT;

int main(){
  miT::const_iterator it;
  miT map;
  it = map.get<T1>().end();
  it = map.get<T1>().end(); // *** this hangs dtor!
  return 0;

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at