A note about namespaces
The standard C++17 filesystem facilities are all provided in a single header, <filesystem>
, and everything in that header is placed in its own namespace: namespace std::filesystem
. This follows the precedent set by C++11's <chrono>
header with its namespace std::chrono
. (This book omits a full treatment of <chrono>
. Its interactions with std::thread
and std::timed_mutex
are covered briefly in Chapter 7, Concurrency.)
This namespacing strategy means that when you use the <filesystem>
facilities, you'll be using identifiers such as std::filesystem::directory_iterator
and std::filesystem::temp_directory_path()
. These fully qualified names are quite unwieldy! But pulling the entire namespace into your current context with a using
declaration is probably an overkill, especially, if you have to do it at file scope. We've all been taught over the past decade never to write using namespace std
, and that advice won't change, no matter how deeply the...