diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2018-12-18 11:20:18 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2018-12-18 11:22:27 +0100 |
| commit | 342412a11405931d46667b179b9e861b8ed39875 (patch) | |
| tree | 4dbe0a0664ae2cac11fe811ef6dafa4297b148b7 | |
| parent | 660472c366c119f09d46d25f1eaeb139e9ec09df (diff) | |
| download | wanda-342412a11405931d46667b179b9e861b8ed39875.tar.xz wanda-342412a11405931d46667b179b9e861b8ed39875.zip | |
wanda: replace boost::iterator with range v3
| -rw-r--r-- | CMakeLists.txt | 1 | ||||
| -rw-r--r-- | conanfile.py | 3 | ||||
| -rw-r--r-- | src/wanda/filesystem.cpp | 9 |
3 files changed, 8 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 79b8421..42d2c2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ add_wanda_library(NAME "wanda" LIBRARIES "CONAN_PKG::asio" "CONAN_PKG::spdlog" + "CONAN_PKG::range-v3" "SYSTEM::C++FS" "Threads::Threads" ) diff --git a/conanfile.py b/conanfile.py index 701cab6..b52a100 100644 --- a/conanfile.py +++ b/conanfile.py @@ -11,6 +11,7 @@ class Wanda(ConanFile): generators = "cmake" default_user = "fmorgner" default_channel = "stable" + build_policy = "missing" settings = ( "os", "arch", @@ -24,9 +25,9 @@ class Wanda(ConanFile): ) requires = ( "asio/1.12.0@bincrafters/stable", - "boost_iterator/1.67.0@bincrafters/stable", "clara/1.1.5@bincrafters/stable", "spdlog/1.2.1@bincrafters/stable", + "range-v3/0.4.0@ericniebler/stable", ) default_options = { "asio:standalone": True, diff --git a/src/wanda/filesystem.cpp b/src/wanda/filesystem.cpp index 01dff43..0cf4607 100644 --- a/src/wanda/filesystem.cpp +++ b/src/wanda/filesystem.cpp @@ -1,6 +1,7 @@ #include <wanda/filesystem.hpp> -#include <boost/iterator/filter_iterator.hpp> +// #include <boost/iterator/filter_iterator.hpp> +#include <range/v3/all.hpp> #include <random> @@ -13,9 +14,9 @@ namespace wanda 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}; + auto begin = std::filesystem::recursive_directory_iterator{source}; + auto end = std::filesystem::recursive_directory_iterator{}; + return ranges::make_iterator_range(begin, end) | ranges::view::filter(filter); } std::filesystem::path random_pick(path_list const & paths) |
