Is there a shared state in std::filesystem::directory_iterator copies?
According to cppreference, std::next
will return an iterator to the next element without modifying the argument iterator (see the example in this page). However, when using it on a std::filesystem::directory_iterator
it actually modifies the argument so that after the call it points to the next directory entry, as shown by this easy program: