Back then, the iterator didn't model the range concept. So, just make your own range: for (const auto& dirEnt : boost::make_iterator_range(fs::recursive_directory_iterator{sourceDir}, {})) { See it Live On GCC 4.8 and Boost 1.54

Context: I need to recursively iterate through a directory; I got a pretty nice function for it from another thread here on SO; adapted it just a tiny bit for my purposes and it works perfectly on Mac with boost 1.62 and clang. However, we're using SemaphoreCI (based on ubuntu 14.04 LTS and boost 1.54) and I just cannot get this to compile under those conditions. #include [boost/algorithm/string/replace.hpp] #include [boost/filesystem.hpp] #include [boost/range.hpp] void copyDirectory

## Matched source
Source: Source: https://stackoverflow.com/questions/45983594/using-recursive-directory-iterator-in-an-old-version-of-boost
Original query: "Using recursive_directory_iterator in an old version of boost?"
Key terms: boost, directory, iterator, recursive, using, version
