I'd like a basic C++ STL-like container for the filesystem.
e.g.
std::filesystem::const_iterator i = filesys.begin();
i->file_name(); i->full_path(),
etc..
Does something like that exist?
Yes. It exists. Almost similar, atleast which can work with the STL iterators and containers.
boost::filesystem
Example:
path p ("directorypath");
std::vector<path> v;
std::copy(directory_iterator(p), directory_iterator(), std::back_inserter(v));
for (std::vector<path>::const_iterator it=v.begin(); it != v.end(); ++it)
{
std::cout << " " << *it << std::endl;
}
I suppose, now you would like to look at directory_iterator
to discover what else it provides.
Another one is STLSOFT platformstl::readdir_sequence.
Example provided here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With