Skip to content

Instantly share code, notes, and snippets.

@ThePhD
Created May 27, 2015 19:43
Show Gist options
  • Select an option

  • Save ThePhD/6baa4eaa11a7c856f8dc to your computer and use it in GitHub Desktop.

Select an option

Save ThePhD/6baa4eaa11a7c856f8dc to your computer and use it in GitHub Desktop.
SFINAE for iterators (which is currently bad, must change to use function-style and then delegate to std::integral_constant IIRC)
namespace detail {
template<typename T, typename = void>
struct is_iterator : std::false_type {
};
template<typename T>
struct is_iterator<T, typename std::enable_if<!std::is_same<typename std::iterator_traits<T>::value_type, void>::value>::type> : std::true_type {
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment