Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Does put override const?
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-08-13 07:16:28


> 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) ?
>

Because the property map (m_eWeight) was originally constructed over a
non-const reference or pointer to the graph.

Andrew Sutton
andrew.n.sutton_at_[hidden]



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