Created
March 29, 2020 14:18
-
-
Save Astro36/f8a37e76f2bdad60409c4324d957ad35 to your computer and use it in GitHub Desktop.
This file contains hidden or 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<typename T, typename Index = std::size_t, typename = void> | |
struct has_subscript_operator : std::false_type {}; | |
template<typename T, typename Index> | |
struct has_subscript_operator<T, Index, std::void_t<decltype(std::declval<T>()[std::declval<Index>()])>> : std::true_type {}; | |
template<typename T, typename Index = int> | |
using has_subscript_operator_v = typename has_subscript_operator<T, Index>::value; | |
template<typename T> | |
using iterator_cat = typename std::iterator_traits<T>::iterator_category; | |
template<typename T, typename = void> | |
struct is_iterator : std::false_type {}; | |
template<typename T> | |
struct is_iterator<T, std::void_t<iterator_cat<T>>> : std::true_type {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment