]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #include <boost/filesystem.hpp> |
2 | #include <boost/range.hpp> | |
3 | #include <boost/range/algorithm.hpp> | |
4 | #include <boost/range/adaptors.hpp> | |
5 | #include <vector> | |
6 | #include <iostream> | |
7 | ||
8 | namespace fs = boost::filesystem; | |
9 | using namespace boost::adaptors; | |
10 | ||
1e59de90 TL |
11 | int main() |
12 | { | |
7c673cae FG |
13 | fs::recursive_directory_iterator beg("."), end; |
14 | ||
1e59de90 TL |
15 | auto fileFilter = [](fs::path const& path) { |
16 | return is_regular_file(path); | |
7c673cae FG |
17 | }; |
18 | ||
1e59de90 TL |
19 | std::vector< fs::path > paths; |
20 | copy(boost::make_iterator_range(beg, end) | filtered(fileFilter), std::back_inserter(paths)); | |
7c673cae | 21 | |
1e59de90 | 22 | for (auto& p : paths) |
7c673cae FG |
23 | std::cout << p << "\n"; |
24 | } |