C++ Logo

SG16

Advanced search

Subject: Re: [SG16-Unicode] [isocpp-lib-ext] Proposed design change to P1030 filesystem::path_view
From: David Stone (david.stone_at_[hidden])
Date: 2019-08-26 16:32:32


I have several times written (and seen written) code like

    auto directory = std::filesystem::path(...);
    for (auto const & path : directory) {
        use(path);
    }

when what I meant was

    auto directory = std::filesystem::path(...);
    for (auto path_it = std::filesystem::directory_iterator(directory);
path_it != std::filesystem::directory_iterator(); ++path_it) {
        use(*path_it);
    }

but I have never intentionally iterated over the components of the path
(and if I did, I would expect to need to apply some transformation to get
that).

I have to agree with Arthur that this is a big source of errors in the
existing API and should not be used as a precedent if at all possible.



SG16 list run by sg16-owner@lists.isocpp.org