Boost logo

Boost :

Subject: [boost] [intrusive] crash with slist push_back
From: Arpan Sen (arpansen_at_[hidden])
Date: 2016-05-10 09:14:48


Hi Boost Dev,

Please consider the following code, this crashes with slist but works just
fine if I replace slist with list. Also flat_map crashes but std::map works
fine. Am I doing something gross or is there a bug here?

#include <iostream>
#include <boost/container/flat_map.hpp>
#include <map>
//#include <boost/intrusive/list.hpp>
#include <boost/intrusive/slist.hpp>

using namespace boost::intrusive;

struct m : public slist_base_hook<>
{
  int n;
  public:
    m(int k) : n(k) { }
};

int main()
{
  boost::container::flat_map<int, slist<m, cache_last<true> > > c1;
  std::map<int, slist<m, cache_last<true> > > c2;
  m* m1 = new m(22);
  c1[1].push_back(*m1);

  m* tt = new m(99);
  c2[1].push_back(*tt);
}

Regards
  Arpan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk