Skip to content
← Back to activity

Immutable solution version

Using recursive_directory_iterator in an old version of boost?

Version 2Sign in to save

Complete solution

Using recursive_directory_iterator in an old version of boost?: Back then, the iterator didn't model the range concept.

Back then, the iterator didn't model the range concept. So, just make your own range: for (const auto& dirEnt : boost::makeiteratorrange(fs::recursivedirectoryiterator{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 recursivedirectoryiterator in an old version of boost?" Key terms: boost, directory, iterator, recursive, using, version

Evidence

Source: 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

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

Source URL: https://stackoverflow.com/questions/45983594/using-recursive-directory-iterator-in-an-old-version-of-boost

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_YowINWoV6XByr2SibpksMg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Using recursive_directory_iterator in an old version of boost? <span>— Vectle</span></a>