diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2018-12-08 10:43:50 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2018-12-08 10:43:50 +0100 |
| commit | 0c1d1a0f24655c22a373c19aac90a6a225a353e6 (patch) | |
| tree | e65fe3c5f8b80bb59910c81c700eb3ed545848bb /src/filesystem.cpp | |
| parent | f22d1b76c9a957a679b57ddcb67b33cc73a15de1 (diff) | |
| download | wanda-0c1d1a0f24655c22a373c19aac90a6a225a353e6.tar.xz wanda-0c1d1a0f24655c22a373c19aac90a6a225a353e6.zip | |
wanda: reformat source code
Diffstat (limited to 'src/filesystem.cpp')
| -rw-r--r-- | src/filesystem.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 4dfa183..bb724d1 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -6,25 +6,24 @@ namespace wanda { - -std::optional<path_list> scan(std::filesystem::path source, bool(filter)(std::filesystem::path const &)) -{ + std::optional<path_list> scan(std::filesystem::path source, bool(filter)(std::filesystem::path const &)) + { if (!std::filesystem::is_directory(source)) { - return std::nullopt; + return std::nullopt; } auto first = boost::make_filter_iterator(filter, std::filesystem::recursive_directory_iterator{source}); auto last = boost::make_filter_iterator(filter, std::filesystem::recursive_directory_iterator{}); return path_list{first, last}; -} + } -std::filesystem::path random_pick(path_list const &paths) -{ + std::filesystem::path random_pick(path_list const & paths) + { static auto generator = std::mt19937{std::random_device{}()}; auto distribution = std::uniform_int_distribution<std::size_t>{0, paths.size() - 1}; return paths[distribution(generator)]; -} + } -} // namespace wanda
\ No newline at end of file +} // namespace wanda
\ No newline at end of file |
