Boost logo

Boost Users :

From: Pavol Droba (droba_at_[hidden])
Date: 2007-02-20 16:15:49


>>
>
> Thanks, I did try just doing this
> cout << copy_range<std::string>(a) << endl;
> cout << copy_range<std::string>(b) << endl;
>
> But I find out that 'integer_compare' just call once, and it is an empty string.
>
> My input strings were "/1/11/2", "1/9/2". From your previous message,
> I understand the first time return an empty string, but I do expect
> integer_compare will call again and again like "1", "11", "2", "1",
> "9" ,"2"....
> But it did not happens.
>
>

Great, we are getting to the finish ;) There is just one slight problem,
that I have overlooked in your code.

lexicographical_compare simply forwards the call to
std::lexicographical_compare
http://www.sgi.com/tech/stl/lexicographical_compare.html

So the given predicate (integer_compare) functions as *isless*. It
means, that it should return true if the first argument is *less* then
the second one. In case of equality it should return false.

In your case, lexicographical_compare stopped on the first tokens, since
the predicate reported that one is less then other. No other comparison
was necessary to get the result.

Try to change the result to false. You should be seeing the output from
whole inputs.

Best regards,
Pavol.


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