std::experi...y_iterator),(3)
okay so this is the std::experi...y_iterator),(3) page from the C++ Standard Libary manual β yes, that's the manual name exactly, spelling and all. We're deep in the std::experimental::filesystem filesystem TS, and this page is all about making recursive_directory_iterator behave for range-based for loops. π
β¨
π¦ NAME π¦
The NAME section literally says:
std::experimental::filesystem::begin(recursive_directory_iterator), -
std::experimental::filesystem::begin(recursive_directory_iterator),
π« Synopsis π«
Exact synopsis vibes:
recursive_directory_iterator begin( recursive_directory_iterator (1)
(filesystem TS)
iter );
recursive_directory_iterator end( const (2)
(filesystem TS)
recursive_directory_iterator& );
(1)(filesystem TS) β returnsiterunchanged.(2)(filesystem TS) β returns a default-constructedrecursive_directory_iterator, which serves as the end iterator. The argument is ignored.
These non-member functions enable the use of recursive_directory_iterators with range-based for loops. Slay. π
πΈ Parameters πΈ
iterβ arecursive_directory_iterator.
β¨ Return value β¨
iterunchanged.- End iterator (default-constructed
recursive_directory_iterator).
π₯ Exceptions π₯
noexcept specification: noexcept.
π Example π
// Run this code
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
namespace fs = std::experimental::filesystem;
int main()
{
fs::create_directories("sandbox/a/b");
std::ofstream("sandbox/file1.txt");
fs::create_symlink("a", "sandbox/syma");
for (auto& p : fs::recursive_directory_iterator("sandbox"))
std::cout << p << '\n';
fs::remove_all("sandbox");
}
π Possible output: π
"sandbox/a"
"sandbox/a/b"
"sandbox/file1.txt"
"sandbox/syma"
π See also π
filesystem::begin(filesystem::directory_iterator)β range-based for loop supportfilesystem::end(filesystem::directory_iterator)β (function)
π§ Categories: π§
- Noindexed pages
- unconditionally noexcept
π Hidden categories: π
- Pages with unreviewed unconditional noexcept template
- Pages with unreviewed noexcept template
okay that's the whole page, bestie. Source: http://cppreference.com, version/date: 2024.06.10 β iconic metadata, no cap. π«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms