Boost logo

Boost Users :

Subject: [Boost-users] [BGL] Does put override const?
From: Caligula (caligulaemperorofrome_at_[hidden])
Date: 2009-08-13 04:35:51


In the code snippet below (which is inside a vis object)
 if the line    //g[*ei].edge_Weight = "Heavy";
is uncommented, compiling gives :error const discarded ( or something to that effect)
because of the const in  (const Graph & g) .

But then how come put(m_eWeight_map, *ei, "Heavy");
compiles successfully and successfully changes the value?
Does   put(m_eWeight_map, *ei, "Heavy");  override the const in
void Change_data(const Graph & g) ?

template < typename Graph >
    void Change_data(const Graph & g)
    //void Change_data(Graph & g)
  {

    typename graph_traits< Graph >::edge_iterator ei, ei_end;

        for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) {
                put(m_eWeight_map, *ei, "Heavy");
                //g[*ei].edge_Weight = "Heavy";

        }

  }

Thanks
- Caligula



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