Boost C++ Libraries: Ticket #8488: Code/doc mismatch in iterator_facade distance_to https://svn.boost.org/trac10/ticket/8488 <p> 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. </p> <p> Specifically, the docs <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> say (paraphrased): a.distance_to(b) is equivalent to distance(a, b). </p> <p> 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! </p> <p> A test case demonstrating the problem is attached. </p> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> <a href="http://www.boost.org/doc/libs/1_53_0/libs/iterator/doc/iterator_facade.html#iterator-facade-requirements">http://www.boost.org/doc/libs/1_53_0/libs/iterator/doc/iterator_facade.html#iterator-facade-requirements</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8488 Trac 1.4.3 gredner@… Tue, 23 Apr 2013 18:40:29 GMT attachment set https://svn.boost.org/trac10/ticket/8488 https://svn.boost.org/trac10/ticket/8488 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.cpp</span> </li> </ul> <p> Self-contained test case demonstrating the problem </p> Ticket