]>
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 | ||
11 | int main() { | |
12 | fs::recursive_directory_iterator beg("."), end; | |
13 | ||
14 | auto fileFilter = [](fs::path const & path) | |
92f5a8d4 | 15 | { |
7c673cae FG |
16 | return is_regular_file(path); |
17 | }; | |
18 | ||
19 | std::vector<fs::path> paths; | |
20 | copy(boost::make_iterator_range(beg, end) | filtered(fileFilter), | |
21 | std::back_inserter(paths)); | |
22 | ||
23 | for(auto& p : paths) | |
24 | std::cout << p << "\n"; | |
25 | } |