AMDG Sascha Ochsenknecht wrote:
should it be possible to re-assign a filesystem::recursive_directory_iterator? I tried something like the following (could strip out my code and build a small test case if needed but this would take some time):
fs::path aPath = ...; // assign to some valid path
const fs::recursive_directory_iterator initial(path); const fs::recursive_directory_iterator end(); fs::recursive_directory_iterator current(path);
// now increment current and do something with it (traverse directories etc). // ...
// Later I want to go back to initial position with: current = initial; <snip>
The state is shared between all copies of a recursive_directory_iterator. You can make it work by storing the path and creating a new iterator when you want to reset. current = recursive_directory_iterator(aPath); In Christ, Steven Watanabe