diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-08-28 21:26:01 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-08-28 21:26:01 +0000 |
commit | 2fc65041beabcb4c970deeb8ece010c10b0b40f9 (patch) | |
tree | 8cce662354b591f6e8dac297a744ae0721a2d7f7 /libcxx/test/support | |
parent | 24b481370ac773231c38f15355a6277943a69911 (diff) | |
download | bcm5719-llvm-2fc65041beabcb4c970deeb8ece010c10b0b40f9.tar.gz bcm5719-llvm-2fc65041beabcb4c970deeb8ece010c10b0b40f9.zip |
Implement LWG 2711. Constrain path members.
llvm-svn: 279945
Diffstat (limited to 'libcxx/test/support')
-rw-r--r-- | libcxx/test/support/test_iterators.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libcxx/test/support/test_iterators.h b/libcxx/test/support/test_iterators.h index d4a079971b1..fb5c06ad943 100644 --- a/libcxx/test/support/test_iterators.h +++ b/libcxx/test/support/test_iterators.h @@ -53,25 +53,27 @@ public: void operator,(T const &) DELETE_FUNCTION; }; -template <class It> +template <class It, + class ItTraits = It> class input_iterator { + using Traits = std::iterator_traits<ItTraits>; It it_; - template <class U> friend class input_iterator; + template <class U, class T> friend class input_iterator; public: typedef std::input_iterator_tag iterator_category; - typedef typename std::iterator_traits<It>::value_type value_type; - typedef typename std::iterator_traits<It>::difference_type difference_type; + typedef typename Traits::value_type value_type; + typedef typename Traits::difference_type difference_type; typedef It pointer; - typedef typename std::iterator_traits<It>::reference reference; + typedef typename Traits::reference reference; It base() const {return it_;} input_iterator() : it_() {} explicit input_iterator(It it) : it_(it) {} - template <class U> - input_iterator(const input_iterator<U>& u) :it_(u.it_) {} + template <class U, class T> + input_iterator(const input_iterator<U, T>& u) :it_(u.it_) {} reference operator*() const {return *it_;} pointer operator->() const {return it_;} @@ -89,18 +91,18 @@ public: void operator,(T const &) DELETE_FUNCTION; }; -template <class T, class U> +template <class T, class TV, class U, class UV> inline bool -operator==(const input_iterator<T>& x, const input_iterator<U>& y) +operator==(const input_iterator<T, TV>& x, const input_iterator<U, UV>& y) { return x.base() == y.base(); } -template <class T, class U> +template <class T, class TV, class U, class UV> inline bool -operator!=(const input_iterator<T>& x, const input_iterator<U>& y) +operator!=(const input_iterator<T, TV>& x, const input_iterator<U, UV>& y) { return !(x == y); } |