https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71044

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Wed Dec 12 16:13:49 2018
New Revision: 267057

URL: https://gcc.gnu.org/viewcvs?rev=267057&root=gcc&view=rev
Log:
Overload std::distance and std::advance for path::iterator

Although filesystem::path::iterator is only a bidirectional iterator,
the underlying sequence has random access iterators (specifically, raw
pointers). This means std::distance and std::advance can be implemented
more efficiently than the generic versions which apply ++ and --
repeatedly.

        PR libstdc++/71044 (partial)
        * include/bits/fs_path.h (__path_iter_distance, __path_iter_advance):
        New friend functions to implement std::distance and std::advance more
        efficiently.
        (distance, advance): Add overloads for path::iterator.
        * testsuite/27_io/filesystem/path/itr/components.cc: Test new
        overload.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/fs_path.h
    trunk/libstdc++-v3/testsuite/27_io/filesystem/path/itr/traversal.cc

Reply via email to