|
Boost Users : |
Subject: Re: [Boost-users] [Range] Strange!
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2014-08-28 17:35:40
2014-08-28 23:29 GMT+02:00 Robert Jones <robertgbjones_at_[hidden]>:
> On 28 August 2014 22:22, Neil Groves <neil_at_[hidden]> wrote:
>
>>
>> The counting_range instance is a unnamed temporary,,,,
>>
>
> So the earlier lines are flawed too, just working by chance?
>
Yes, combinations of counting_range with reversed. But not because
counting_range is a temporary.
I think the problem is counting_iterator returns a reference to an int it
owns. Iterators shouldn't do that.
Iterators should either:
- return a reference to something they don't own, or
- return by value.
Regards,
Kris
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