From 77bcb2f6d8d0afa0465dd921fa2e7fb64f1433b6 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Fri, 21 Nov 2014 20:30:34 +0100 Subject: use boost::iterator_range instead of homebrew hack --- hadori.C | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/hadori.C b/hadori.C index f4f8e46..62cfc38 100644 --- a/hadori.C +++ b/hadori.C @@ -20,6 +20,8 @@ #include namespace po = boost::program_options; +#include + #include #include #include @@ -38,18 +40,6 @@ namespace po = boost::program_options; #include "version.h" -// needed for equal_range and range-for -namespace std { -template -typename enable_if::iterator_category>::value, It&>::type begin(pair & p) { - return p.first; -} -template -typename enable_if::iterator_category>::value, It&>::type end(pair & p) { - return p.second; -} -} - po::variables_map config; std::ostream debug(std::clog.rdbuf()), verbose(std::clog.rdbuf()), error(std::clog.rdbuf()); @@ -122,7 +112,7 @@ void handle_file(std::string const & path, struct stat const & s) { } inode f{path, s}; debug << f << " is new to us" << std::endl; - for (auto const & it : sizes.equal_range(s.st_size)) { + for (auto const & it : boost::make_iterator_range(sizes.equal_range(s.st_size))) { inode const & candidate = kept.find(it.second)->second; debug << "looking if it matches " << candidate << std::endl; if (candidate.stat.st_mode != s.st_mode) -- cgit v1.2.3