summaryrefslogtreecommitdiff
path: root/hadori.C
diff options
context:
space:
mode:
authorTimo Weingärtner <timo@tiwe.de>2014-11-21 20:30:34 +0100
committerTimo Weingärtner <timo@tiwe.de>2014-11-21 20:30:34 +0100
commit77bcb2f6d8d0afa0465dd921fa2e7fb64f1433b6 (patch)
tree19ea843f90acae081dfcfb35b4e8d2697c9239bd /hadori.C
parent3c42fb81eb2cc9e658afc2156afa5d62880f3c7e (diff)
downloadhadori-77bcb2f6d8d0afa0465dd921fa2e7fb64f1433b6.tar.gz
use boost::iterator_range instead of homebrew hack
Diffstat (limited to 'hadori.C')
-rw-r--r--hadori.C16
1 files 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 <boost/program_options.hpp>
namespace po = boost::program_options;
+#include <boost/range/iterator_range.hpp>
+
#include <string>
#include <vector>
#include <queue>
@@ -38,18 +40,6 @@ namespace po = boost::program_options;
#include "version.h"
-// needed for equal_range and range-for
-namespace std {
-template<typename It>
-typename enable_if<is_base_of<input_iterator_tag, typename iterator_traits<It>::iterator_category>::value, It&>::type begin(pair<It,It> & p) {
- return p.first;
-}
-template<typename It>
-typename enable_if<is_base_of<input_iterator_tag, typename iterator_traits<It>::iterator_category>::value, It&>::type end(pair<It,It> & 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)