28 May
2009
28 May
'09
10:30 a.m.
Mathias Gaunard wrote:
Lindley M French wrote:
Okay, that makes sense as a cause, anyway. I'm not clear on how to fix it.
Well, given the cause is temporaries due to implicit conversions, just don't make those implicit conversions.
just change const Group& operator()(const std::pair
&p) const to const Group& operator()(const std::pair
&p) const
The fact that the value of a map iterator does not exactly resemble the declaration of the map itself (implicit 'const' on the key) has bitten me more often than I care to admit. I've been trying to cultivate the habit of always using my_map_typedef::value_type whenever the std::pair in question comes from a map. So: const Group& operator()(const OP_map_typedef::value_type& p) const