I would like to write a C++ function that fills a vector with the filename of all of the files in a directory. Furthermore, I would like this vector to be ordered by the last modified time of the files.
I can use boost:: filesystem to read in all of the files in the directory and pass it to a vector, but these get loaded to the vector by filename and then I have stat the file and perform a sort which is not very efficient.
Does anybody know of a quick way to do this? For instance, ls -lhctr can do it almost instantly so C++ should be able to do this very quickly for a large directory as well.
I would also like this to have sub-millisecond resolution if possible.
Maybe
map/multimap<std::time_t/dt::ptime, std::string/fs::path>?