Boost logo

Boost :

Subject: Re: [boost] Iterator Range and operator==
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-04-20 09:19:00


On 20/04/12 14:15, Olaf van der Spek wrote:
> Hi,
>
> What do you expect this code to do? Is b true or false? And why?
> Is this expected behaviour?
>
> #include<boost/range/iterator_range.hpp>
> #include<string>
>
> int main()
> {
> std::string s = "Olaf";
> boost::iterator_range<std::string::iterator> r(s);
> bool a = r == s;

a is true.

> bool b = r == "Olaf";

b is false, "Olaf" is one character longer than r.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk