Last active
December 27, 2015 10:49
-
-
Save justinvh/7314337 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class OutputIter, class = void> | |
class Foo; | |
template <class OutputIter> | |
class Foo<OutputIter, is_output_iterator<OutputIter>> { | |
/* some class with an output iterator */ | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iterator> | |
#include <type_traits> | |
template <class Iter, class Tag> | |
using has_tag = | |
std::enable_if< | |
std::is_convertible< | |
typename std::iterator_traits<Iter>::iterator_category, | |
Tag>::value, | |
Iter>; | |
template <typename Iter> | |
using is_output_iterator = has_tag<Iter, std::output_iterator_tag>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment