Opened 6 years ago

#8488 new Bugs

Code/doc mismatch in iterator_facade distance_to

Reported by: gredner@… Owned by: jeffrey.hellrung
Milestone: To Be Determined Component: iterator
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc: jeffrey.hellrung@…


When creating a random access facade, one must implement the distance_to member function in order for std::distance to work. However, it looks like the arguments passed to this method are reversed from what the documentation states.

Specifically, the docs [1] say (paraphrased): a.distance_to(b) is equivalent to distance(a, b).

However, when I call std::distance(a, b), I find that b.distance_to(a) is invoked in the facade - the mirror image of what the docs say!

A test case demonstrating the problem is attached.


Attachments (1)

main.cpp (1.2 KB) - added by gredner@… 6 years ago.
Self-contained test case demonstrating the problem

Download all attachments as: .zip

Change History (1)

Changed 6 years ago by gredner@…

Attachment: main.cpp added

Self-contained test case demonstrating the problem

Note: See TracTickets for help on using tickets.