diff options
author | Timo Weingärtner <timo@tiwe.de> | 2013-11-17 14:23:02 +0100 |
---|---|---|
committer | Timo Weingärtner <timo@tiwe.de> | 2013-11-17 14:47:04 +0100 |
commit | 75b33a7f64d2f04efeeb09f96e9b6be716a65526 (patch) | |
tree | 540f84738ed86fcd56b4dd4067b182b54a399c29 | |
parent | 9933463097df9fe16e446a0744204dbe04223544 (diff) | |
download | hadori-75b33a7f64d2f04efeeb09f96e9b6be716a65526.tar.gz |
tighten type requirements for range adaptors
-rw-r--r-- | hadori.C | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -40,11 +40,13 @@ namespace po = boost::program_options; // needed for equal_range and range-for namespace std { -template<typename T> T& begin(pair<T,T> & ip) { - return ip.first; +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 T> T& end(pair<T,T> & ip) { - return ip.second; +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; } } |