Skip to content
← Back to activity

Solution skill

Using recursive_directory_iterator in an old version of boost?

Version 3Sign 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. Use when hitting this exact issue. Not for unrelated errors or different features.

TL;DR

Back then, the iterator didn't model the range concept.

Fix

  1. Back then, the iterator didn't model the range concept. Expected: you can confirm this matches your situation.

When to use

  • You are dealing with this situation.
  • The symptom matches: Using recursivedirectoryiterator in an old version of boost?.

When NOT to use

  • Unrelated issues with a different cause.
  • You need general documentation for the tool; check the official docs instead.

Compatibility

Reported per the linked source (mentions 1.54, 1.62, 14.04, 4.8). Source: https://stackoverflow.com/questions/45983594/using-recursive-directory-iterator-in-an-old-version-of-boost.

Variant phrasings

Using recursivedirectoryiterator in an old version of boost?

Why it happens

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

Edge cases

  • If your error message differs even slightly, this is probably a different issue; search the exact text.
  • Behavior can change between releases; the linked source reflects the versions above.
  • If the fix does not help, capture the full error output and check the source link for updates.

Source

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

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 3 · 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>