diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2018-11-13 05:33:31 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2018-11-13 05:33:31 +0000 |
| commit | d4fa0381e35b68fccff8070764282f07b3eb7711 (patch) | |
| tree | f7097dd649694fb82fd608b7c62ebc910ffa86b6 /libcxx/include/iterator | |
| parent | 245d94776f971903c0e238485c7a985c0a740dab (diff) | |
| download | bcm5719-llvm-d4fa0381e35b68fccff8070764282f07b3eb7711.tar.gz bcm5719-llvm-d4fa0381e35b68fccff8070764282f07b3eb7711.zip | |
Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
llvm-svn: 346738
Diffstat (limited to 'libcxx/include/iterator')
| -rw-r--r-- | libcxx/include/iterator | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libcxx/include/iterator b/libcxx/include/iterator index aed0525dbf8..bda177e11e6 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -438,6 +438,23 @@ struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {}; template <class _Tp> +struct __has_iterator_typedefs +{ +private: + struct __two {char __lx; char __lxx;}; + template <class _Up> static __two __test(...); + template <class _Up> static char __test(typename std::__void_t<typename _Up::iterator_category>::type* = 0, + typename std::__void_t<typename _Up::difference_type>::type* = 0, + typename std::__void_t<typename _Up::value_type>::type* = 0, + typename std::__void_t<typename _Up::reference>::type* = 0, + typename std::__void_t<typename _Up::pointer>::type* = 0 + ); +public: + static const bool value = sizeof(__test<_Tp>(0,0,0,0,0)) == 1; +}; + + +template <class _Tp> struct __has_iterator_category { private: @@ -479,7 +496,7 @@ struct __iterator_traits<_Iter, true> template <class _Iter> struct _LIBCPP_TEMPLATE_VIS iterator_traits - : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {}; + : __iterator_traits<_Iter, __has_iterator_typedefs<_Iter>::value> {}; template<class _Tp> struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> |

