Boost logo

Boost Users :

Subject: Re: [Boost-users] transform_iterator causing strange problems
From: Nat Goodspeed (nat_at_[hidden])
Date: 2009-05-28 06:30:41


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<GroupID, Group> &p) const
>
> to
> const Group& operator()(const std::pair<const GroupID, Group> &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


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