Boost logo

Boost Users :

Subject: [Boost-users] seg fault
From: John Robertson (jrobertson7711_at_[hidden])
Date: 2009-10-22 18:36:39


The following compiles and runs.

typedef string Colour;

struct edge_properties
{
 
  vector < set< Colour > > eColours;

}

//get a reference to the vector of the sets of colours of some edge.
vector < set<Colour> > & v_colour_outset =  get(m_eColours_map,*out_iter);    // Here *out_iter is some edge.                               
                                              
//Add a set<Colour> to  v_colour_outset ie. to get(m_eColours_map,*out_iter) .
set<Colour> colour_set;
v_colour_outset.push_back(colour_set);
                                       
// get a reference to one of the set<colour> in get(m_eColours_map,*out_iter) .                  set<Colour> & outcset = v_colour_outset[1];    //or [0], or any elt.

But when I try to add a new colour to this set
 
outcset.insert("Blue");

I get segfault.
My guess is that there is a predetermined size for colour_set, and when it is push_backed into v_colour_outset, a new colour cannot be added into it.

Thanks
- JR



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net