Date: Wed, 17 May 2017 20:23:06 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r318420 - in vendor/libc++/dist: include test/std/iterators/iterator.primitives/iterator.operations test/std/utilities/optional/optional.object/optional.object.ctor test/support Message-ID: <201705172023.v4HKN6eg015568@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Wed May 17 20:23:06 2017 New Revision: 318420 URL: https://svnweb.freebsd.org/changeset/base/318420 Log: Vendor import of libc++ trunk r303291: https://llvm.org/svn/llvm-project/libcxx/trunk@303291 Modified: vendor/libc++/dist/include/iterator vendor/libc++/dist/include/optional vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp vendor/libc++/dist/test/support/test_iterators.h Modified: vendor/libc++/dist/include/iterator ============================================================================== --- vendor/libc++/dist/include/iterator Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/include/iterator Wed May 17 20:23:06 2017 (r318420) @@ -64,14 +64,23 @@ struct forward_iterator_tag : publ struct bidirectional_iterator_tag : public forward_iterator_tag {}; struct random_access_iterator_tag : public bidirectional_iterator_tag {}; +// 27.4.3, iterator operations // extension: second argument not conforming to C++03 -template <class InputIterator> -void advance(InputIterator& i, +template <class InputIterator> // constexpr in C++17 + constexpr void advance(InputIterator& i, typename iterator_traits<InputIterator>::difference_type n); -template <class InputIterator> -typename iterator_traits<InputIterator>::difference_type -distance(InputIterator first, InputIterator last); +template <class InputIterator> // constexpr in C++17 + constexpr typename iterator_traits<InputIterator>::difference_type + distance(InputIterator first, InputIterator last); + +template <class InputIterator> // constexpr in C++17 + constexpr InputIterator next(InputIterator x, +typename iterator_traits<InputIterator>::difference_type n = 1); + +template <class BidirectionalIterator> // constexpr in C++17 + constexpr BidirectionalIterator prev(BidirectionalIterator x, + typename iterator_traits<BidirectionalIterator>::difference_type n = 1); template <class Iterator> class reverse_iterator @@ -529,7 +538,7 @@ struct _LIBCPP_TEMPLATE_VIS iterator }; template <class _InputIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void __advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) { @@ -538,7 +547,7 @@ void __advance(_InputIter& __i, } template <class _BiDirIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) { @@ -551,7 +560,7 @@ void __advance(_BiDirIter& __i, } template <class _RandIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) { @@ -559,7 +568,7 @@ void __advance(_RandIter& __i, } template <class _InputIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 void advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n) { @@ -567,7 +576,7 @@ void advance(_InputIter& __i, } template <class _InputIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 typename iterator_traits<_InputIter>::difference_type __distance(_InputIter __first, _InputIter __last, input_iterator_tag) { @@ -578,7 +587,7 @@ __distance(_InputIter __first, _InputIte } template <class _RandIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 typename iterator_traits<_RandIter>::difference_type __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) { @@ -586,7 +595,7 @@ __distance(_RandIter __first, _RandIter } template <class _InputIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 typename iterator_traits<_InputIter>::difference_type distance(_InputIter __first, _InputIter __last) { @@ -594,7 +603,7 @@ distance(_InputIter __first, _InputIter } template <class _InputIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _InputIter next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1, @@ -605,7 +614,7 @@ next(_InputIter __x, } template <class _BidiretionalIter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _BidiretionalIter prev(_BidiretionalIter __x, typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, Modified: vendor/libc++/dist/include/optional ============================================================================== --- vendor/libc++/dist/include/optional Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/include/optional Wed May 17 20:23:06 2017 (r318420) @@ -599,8 +599,8 @@ private: public: _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {} - _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default; - _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default; + _LIBCPP_INLINE_VISIBILITY constexpr optional(const optional&) = default; + _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default; _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {} template <class... _Args, class = enable_if_t< Modified: vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp Wed May 17 20:23:06 2017 (r318420) @@ -9,14 +9,16 @@ // <iterator> +// All of these became constexpr in C++17 +// // template <InputIterator Iter> -// void advance(Iter& i, Iter::difference_type n); +// constexpr void advance(Iter& i, Iter::difference_type n); // // template <BidirectionalIterator Iter> -// void advance(Iter& i, Iter::difference_type n); +// constexpr void advance(Iter& i, Iter::difference_type n); // // template <RandomAccessIterator Iter> -// void advance(Iter& i, Iter::difference_type n); +// constexpr void advance(Iter& i, Iter::difference_type n); #include <iterator> #include <cassert> @@ -31,8 +33,19 @@ test(It i, typename std::iterator_traits assert(i == x); } +#if TEST_STD_VER > 14 +template <class It> +constexpr bool +constepxr_test(It i, typename std::iterator_traits<It>::difference_type n, It x) +{ + std::advance(i, n); + return i == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(input_iterator<const char*>(s), 10, input_iterator<const char*>(s+10)); test(forward_iterator<const char*>(s), 10, forward_iterator<const char*>(s+10)); @@ -42,4 +55,18 @@ int main() test(random_access_iterator<const char*>(s+5), -5, random_access_iterator<const char*>(s)); test(s+5, 5, s+10); test(s+5, -5, s); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constepxr_test(input_iterator<const char*>(s), 10, input_iterator<const char*>(s+10)), "" ); + static_assert( constepxr_test(forward_iterator<const char*>(s), 10, forward_iterator<const char*>(s+10)), "" ); + static_assert( constepxr_test(bidirectional_iterator<const char*>(s+5), 5, bidirectional_iterator<const char*>(s+10)), "" ); + static_assert( constepxr_test(bidirectional_iterator<const char*>(s+5), -5, bidirectional_iterator<const char*>(s)), "" ); + static_assert( constepxr_test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s+10)), "" ); + static_assert( constepxr_test(random_access_iterator<const char*>(s+5), -5, random_access_iterator<const char*>(s)), "" ); + static_assert( constepxr_test(s+5, 5, s+10), "" ); + static_assert( constepxr_test(s+5, -5, s), "" ); + } +#endif } Modified: vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp Wed May 17 20:23:06 2017 (r318420) @@ -29,12 +29,33 @@ test(It first, It last, typename std::it assert(std::distance(first, last) == x); } +#if TEST_STD_VER > 14 +template <class It> +constexpr bool +constexpr_test(It first, It last, typename std::iterator_traits<It>::difference_type x) +{ + return std::distance(first, last) == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(input_iterator<const char*>(s), input_iterator<const char*>(s+10), 10); test(forward_iterator<const char*>(s), forward_iterator<const char*>(s+10), 10); test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+10), 10); test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+10), 10); test(s, s+10, 10); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constexpr_test(input_iterator<const char*>(s), input_iterator<const char*>(s+10), 10), ""); + static_assert( constexpr_test(forward_iterator<const char*>(s), forward_iterator<const char*>(s+10), 10), ""); + static_assert( constexpr_test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+10), 10), ""); + static_assert( constexpr_test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+10), 10), ""); + static_assert( constexpr_test(s, s+10, 10), ""); + } +#endif } Modified: vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp Wed May 17 20:23:06 2017 (r318420) @@ -33,8 +33,25 @@ test(It i, It x) assert(std::next(i) == x); } +#if TEST_STD_VER > 14 +template <class It> +constexpr bool +constexpr_test(It i, typename std::iterator_traits<It>::difference_type n, It x) +{ + return std::next(i, n) == x; +} + +template <class It> +constexpr bool +constexpr_test(It i, It x) +{ + return std::next(i) == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(input_iterator<const char*>(s), 10, input_iterator<const char*>(s+10)); test(forward_iterator<const char*>(s), 10, forward_iterator<const char*>(s+10)); @@ -47,4 +64,21 @@ int main() test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1)); test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1)); test(s, s+1); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constexpr_test(input_iterator<const char*>(s), 10, input_iterator<const char*>(s+10)), "" ); + static_assert( constexpr_test(forward_iterator<const char*>(s), 10, forward_iterator<const char*>(s+10)), "" ); + static_assert( constexpr_test(bidirectional_iterator<const char*>(s), 10, bidirectional_iterator<const char*>(s+10)), "" ); + static_assert( constexpr_test(random_access_iterator<const char*>(s), 10, random_access_iterator<const char*>(s+10)), "" ); + static_assert( constexpr_test(s, 10, s+10), "" ); + + static_assert( constexpr_test(input_iterator<const char*>(s), input_iterator<const char*>(s+1)), "" ); + static_assert( constexpr_test(forward_iterator<const char*>(s), forward_iterator<const char*>(s+1)), "" ); + static_assert( constexpr_test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1)), "" ); + static_assert( constexpr_test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1)), "" ); + static_assert( constexpr_test(s, s+1), "" ); + } +#endif } Modified: vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp Wed May 17 20:23:06 2017 (r318420) @@ -31,8 +31,25 @@ test(It i, It x) assert(std::prev(i) == x); } +#if TEST_STD_VER > 14 +template <class It> +constexpr bool +constexpr_test(It i, typename std::iterator_traits<It>::difference_type n, It x) +{ + return std::prev(i, n) == x; +} + +template <class It> +constexpr bool +constexpr_test(It i, It x) +{ + return std::prev(i) == x; +} +#endif + int main() { + { const char* s = "1234567890"; test(bidirectional_iterator<const char*>(s+10), 10, bidirectional_iterator<const char*>(s)); test(random_access_iterator<const char*>(s+10), 10, random_access_iterator<const char*>(s)); @@ -41,4 +58,18 @@ int main() test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s)); test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s)); test(s+1, s); + } +#if TEST_STD_VER > 14 + { + constexpr const char* s = "1234567890"; + static_assert( constexpr_test(bidirectional_iterator<const char*>(s+10), 10, bidirectional_iterator<const char*>(s)), "" ); + static_assert( constexpr_test(random_access_iterator<const char*>(s+10), 10, random_access_iterator<const char*>(s)), "" ); + static_assert( constexpr_test(s+10, 10, s), "" ); + + static_assert( constexpr_test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s)), "" ); + static_assert( constexpr_test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s)), "" ); + static_assert( constexpr_test(s+1, s), "" ); + } +#endif + } Modified: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp Wed May 17 20:23:06 2017 (r318420) @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // <optional> -// optional(const optional<T>& rhs); +// constexpr optional(const optional<T>& rhs); #include <optional> #include <type_traits> @@ -152,4 +152,9 @@ int main() { test_reference_extension(); } + { + constexpr std::optional<int> o1{4}; + constexpr std::optional<int> o2 = o1; + static_assert( *o2 == 4, "" ); + } } Modified: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp Wed May 17 20:23:06 2017 (r318420) @@ -18,7 +18,7 @@ // <optional> -// optional(optional<T>&& rhs); +// constexpr optional(optional<T>&& rhs); #include <optional> #include <type_traits> @@ -206,4 +206,9 @@ int main() { test_reference_extension(); } + { + constexpr std::optional<int> o1{4}; + constexpr std::optional<int> o2 = std::move(o1); + static_assert( *o2 == 4, "" ); + } } Modified: vendor/libc++/dist/test/support/test_iterators.h ============================================================================== --- vendor/libc++/dist/test/support/test_iterators.h Wed May 17 20:23:03 2017 (r318419) +++ vendor/libc++/dist/test/support/test_iterators.h Wed May 17 20:23:06 2017 (r318420) @@ -68,23 +68,23 @@ public: typedef It pointer; typedef typename Traits::reference reference; - It base() const {return it_;} + TEST_CONSTEXPR_CXX14 It base() const {return it_;} - input_iterator() : it_() {} - explicit input_iterator(It it) : it_(it) {} + TEST_CONSTEXPR_CXX14 input_iterator() : it_() {} + explicit TEST_CONSTEXPR_CXX14 input_iterator(It it) : it_(it) {} template <class U, class T> - input_iterator(const input_iterator<U, T>& u) :it_(u.it_) {} + TEST_CONSTEXPR_CXX14 input_iterator(const input_iterator<U, T>& u) :it_(u.it_) {} - reference operator*() const {return *it_;} - pointer operator->() const {return it_;} + TEST_CONSTEXPR_CXX14 reference operator*() const {return *it_;} + TEST_CONSTEXPR_CXX14 pointer operator->() const {return it_;} - input_iterator& operator++() {++it_; return *this;} - input_iterator operator++(int) + TEST_CONSTEXPR_CXX14 input_iterator& operator++() {++it_; return *this;} + TEST_CONSTEXPR_CXX14 input_iterator operator++(int) {input_iterator tmp(*this); ++(*this); return tmp;} - friend bool operator==(const input_iterator& x, const input_iterator& y) + friend TEST_CONSTEXPR_CXX14 bool operator==(const input_iterator& x, const input_iterator& y) {return x.it_ == y.it_;} - friend bool operator!=(const input_iterator& x, const input_iterator& y) + friend TEST_CONSTEXPR_CXX14 bool operator!=(const input_iterator& x, const input_iterator& y) {return !(x == y);} template <class T> @@ -120,23 +120,23 @@ public: typedef It pointer; typedef typename std::iterator_traits<It>::reference reference; - It base() const {return it_;} + TEST_CONSTEXPR_CXX14 It base() const {return it_;} - forward_iterator() : it_() {} - explicit forward_iterator(It it) : it_(it) {} + TEST_CONSTEXPR_CXX14 forward_iterator() : it_() {} + explicit TEST_CONSTEXPR_CXX14 forward_iterator(It it) : it_(it) {} template <class U> - forward_iterator(const forward_iterator<U>& u) :it_(u.it_) {} + TEST_CONSTEXPR_CXX14 forward_iterator(const forward_iterator<U>& u) :it_(u.it_) {} - reference operator*() const {return *it_;} - pointer operator->() const {return it_;} + TEST_CONSTEXPR_CXX14 reference operator*() const {return *it_;} + TEST_CONSTEXPR_CXX14 pointer operator->() const {return it_;} - forward_iterator& operator++() {++it_; return *this;} - forward_iterator operator++(int) + TEST_CONSTEXPR_CXX14 forward_iterator& operator++() {++it_; return *this;} + TEST_CONSTEXPR_CXX14 forward_iterator operator++(int) {forward_iterator tmp(*this); ++(*this); return tmp;} - friend bool operator==(const forward_iterator& x, const forward_iterator& y) + friend TEST_CONSTEXPR_CXX14 bool operator==(const forward_iterator& x, const forward_iterator& y) {return x.it_ == y.it_;} - friend bool operator!=(const forward_iterator& x, const forward_iterator& y) + friend TEST_CONSTEXPR_CXX14 bool operator!=(const forward_iterator& x, const forward_iterator& y) {return !(x == y);} template <class T> @@ -145,7 +145,7 @@ public: template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator==(const forward_iterator<T>& x, const forward_iterator<U>& y) { return x.base() == y.base(); @@ -153,7 +153,7 @@ operator==(const forward_iterator<T>& x, template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator!=(const forward_iterator<T>& x, const forward_iterator<U>& y) { return !(x == y); @@ -172,22 +172,22 @@ public: typedef It pointer; typedef typename std::iterator_traits<It>::reference reference; - It base() const {return it_;} + TEST_CONSTEXPR_CXX14 It base() const {return it_;} - bidirectional_iterator() : it_() {} - explicit bidirectional_iterator(It it) : it_(it) {} + TEST_CONSTEXPR_CXX14 bidirectional_iterator() : it_() {} + explicit TEST_CONSTEXPR_CXX14 bidirectional_iterator(It it) : it_(it) {} template <class U> - bidirectional_iterator(const bidirectional_iterator<U>& u) :it_(u.it_) {} + TEST_CONSTEXPR_CXX14 bidirectional_iterator(const bidirectional_iterator<U>& u) :it_(u.it_) {} - reference operator*() const {return *it_;} - pointer operator->() const {return it_;} + TEST_CONSTEXPR_CXX14 reference operator*() const {return *it_;} + TEST_CONSTEXPR_CXX14 pointer operator->() const {return it_;} - bidirectional_iterator& operator++() {++it_; return *this;} - bidirectional_iterator operator++(int) + TEST_CONSTEXPR_CXX14 bidirectional_iterator& operator++() {++it_; return *this;} + TEST_CONSTEXPR_CXX14 bidirectional_iterator operator++(int) {bidirectional_iterator tmp(*this); ++(*this); return tmp;} - bidirectional_iterator& operator--() {--it_; return *this;} - bidirectional_iterator operator--(int) + TEST_CONSTEXPR_CXX14 bidirectional_iterator& operator--() {--it_; return *this;} + TEST_CONSTEXPR_CXX14 bidirectional_iterator operator--(int) {bidirectional_iterator tmp(*this); --(*this); return tmp;} template <class T> @@ -196,7 +196,7 @@ public: template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator==(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y) { return x.base() == y.base(); @@ -204,7 +204,7 @@ operator==(const bidirectional_iterator< template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator!=(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y) { return !(x == y); @@ -223,34 +223,34 @@ public: typedef It pointer; typedef typename std::iterator_traits<It>::reference reference; - It base() const {return it_;} + TEST_CONSTEXPR_CXX14 It base() const {return it_;} - random_access_iterator() : it_() {} - explicit random_access_iterator(It it) : it_(it) {} - template <class U> - random_access_iterator(const random_access_iterator<U>& u) :it_(u.it_) {} + TEST_CONSTEXPR_CXX14 random_access_iterator() : it_() {} + explicit TEST_CONSTEXPR_CXX14 random_access_iterator(It it) : it_(it) {} + template <class U> + TEST_CONSTEXPR_CXX14 random_access_iterator(const random_access_iterator<U>& u) :it_(u.it_) {} - reference operator*() const {return *it_;} - pointer operator->() const {return it_;} + TEST_CONSTEXPR_CXX14 reference operator*() const {return *it_;} + TEST_CONSTEXPR_CXX14 pointer operator->() const {return it_;} - random_access_iterator& operator++() {++it_; return *this;} - random_access_iterator operator++(int) + TEST_CONSTEXPR_CXX14 random_access_iterator& operator++() {++it_; return *this;} + TEST_CONSTEXPR_CXX14 random_access_iterator operator++(int) {random_access_iterator tmp(*this); ++(*this); return tmp;} - random_access_iterator& operator--() {--it_; return *this;} - random_access_iterator operator--(int) + TEST_CONSTEXPR_CXX14 random_access_iterator& operator--() {--it_; return *this;} + TEST_CONSTEXPR_CXX14 random_access_iterator operator--(int) {random_access_iterator tmp(*this); --(*this); return tmp;} - random_access_iterator& operator+=(difference_type n) {it_ += n; return *this;} - random_access_iterator operator+(difference_type n) const + TEST_CONSTEXPR_CXX14 random_access_iterator& operator+=(difference_type n) {it_ += n; return *this;} + TEST_CONSTEXPR_CXX14 random_access_iterator operator+(difference_type n) const {random_access_iterator tmp(*this); tmp += n; return tmp;} - friend random_access_iterator operator+(difference_type n, random_access_iterator x) + friend TEST_CONSTEXPR_CXX14 random_access_iterator operator+(difference_type n, random_access_iterator x) {x += n; return x;} - random_access_iterator& operator-=(difference_type n) {return *this += -n;} - random_access_iterator operator-(difference_type n) const + TEST_CONSTEXPR_CXX14 random_access_iterator& operator-=(difference_type n) {return *this += -n;} + TEST_CONSTEXPR_CXX14 random_access_iterator operator-(difference_type n) const {random_access_iterator tmp(*this); tmp -= n; return tmp;} - reference operator[](difference_type n) const {return it_[n];} + TEST_CONSTEXPR_CXX14 reference operator[](difference_type n) const {return it_[n];} template <class T> void operator,(T const &) DELETE_FUNCTION; @@ -258,7 +258,7 @@ public: template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator==(const random_access_iterator<T>& x, const random_access_iterator<U>& y) { return x.base() == y.base(); @@ -266,7 +266,7 @@ operator==(const random_access_iterator< template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator!=(const random_access_iterator<T>& x, const random_access_iterator<U>& y) { return !(x == y); @@ -274,7 +274,7 @@ operator!=(const random_access_iterator< template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator<(const random_access_iterator<T>& x, const random_access_iterator<U>& y) { return x.base() < y.base(); @@ -282,7 +282,7 @@ operator<(const random_access_iterator<T template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator<=(const random_access_iterator<T>& x, const random_access_iterator<U>& y) { return !(y < x); @@ -290,7 +290,7 @@ operator<=(const random_access_iterator< template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator>(const random_access_iterator<T>& x, const random_access_iterator<U>& y) { return y < x; @@ -298,14 +298,14 @@ operator>(const random_access_iterator<T template <class T, class U> inline -bool +bool TEST_CONSTEXPR_CXX14 operator>=(const random_access_iterator<T>& x, const random_access_iterator<U>& y) { return !(x < y); } template <class T, class U> -inline +inline TEST_CONSTEXPR_CXX14 typename std::iterator_traits<T>::difference_type operator-(const random_access_iterator<T>& x, const random_access_iterator<U>& y) { @@ -313,22 +313,22 @@ operator-(const random_access_iterator<T } template <class Iter> -inline Iter base(output_iterator<Iter> i) { return i.base(); } +inline TEST_CONSTEXPR_CXX14 Iter base(output_iterator<Iter> i) { return i.base(); } template <class Iter> -inline Iter base(input_iterator<Iter> i) { return i.base(); } +inline TEST_CONSTEXPR_CXX14 Iter base(input_iterator<Iter> i) { return i.base(); } template <class Iter> -inline Iter base(forward_iterator<Iter> i) { return i.base(); } +inline TEST_CONSTEXPR_CXX14 Iter base(forward_iterator<Iter> i) { return i.base(); } template <class Iter> -inline Iter base(bidirectional_iterator<Iter> i) { return i.base(); } +inline TEST_CONSTEXPR_CXX14 Iter base(bidirectional_iterator<Iter> i) { return i.base(); } template <class Iter> -inline Iter base(random_access_iterator<Iter> i) { return i.base(); } +inline TEST_CONSTEXPR_CXX14 Iter base(random_access_iterator<Iter> i) { return i.base(); } template <class Iter> // everything else -inline Iter base(Iter i) { return i; } +inline TEST_CONSTEXPR_CXX14 Iter base(Iter i) { return i; } template <typename T> struct ThrowingIterator {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705172023.v4HKN6eg015568>