Implement NULL iterators for <forward_list> and <deque> re: N3644
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65d2e6a392
commit
5a11f94583
@ -278,7 +278,11 @@ public:
|
||||
typedef random_access_iterator_tag iterator_category;
|
||||
typedef _Reference reference;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
: __m_iter_(nullptr), __ptr_(nullptr)
|
||||
#endif
|
||||
{}
|
||||
|
||||
template <class _Pp, class _Rp, class _MP>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -44,4 +44,23 @@ int main()
|
||||
assert(i == j);
|
||||
}
|
||||
#endif
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
{ // N3664 testing
|
||||
std::deque<int>::iterator ii1{}, ii2{};
|
||||
std::deque<int>::iterator ii4 = ii1;
|
||||
std::deque<int>::const_iterator cii{};
|
||||
assert ( ii1 == ii2 );
|
||||
assert ( ii1 == ii4 );
|
||||
assert ( ii1 == cii );
|
||||
|
||||
assert ( !(ii1 != ii2 ));
|
||||
assert ( !(ii1 != cii ));
|
||||
|
||||
// std::deque<int> c;
|
||||
// assert ( ii1 != c.cbegin());
|
||||
// assert ( cii != c.begin());
|
||||
// assert ( cii != c.cend());
|
||||
// assert ( ii1 != c.end());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -120,4 +120,23 @@ int main()
|
||||
C::const_iterator j;
|
||||
}
|
||||
#endif
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
{ // N3664 testing
|
||||
std::forward_list<int>::iterator ii1{}, ii2{};
|
||||
std::forward_list<int>::iterator ii4 = ii1;
|
||||
std::forward_list<int>::const_iterator cii{};
|
||||
assert ( ii1 == ii2 );
|
||||
assert ( ii1 == ii4 );
|
||||
assert ( ii1 == cii );
|
||||
|
||||
assert ( !(ii1 != ii2 ));
|
||||
assert ( !(ii1 != cii ));
|
||||
|
||||
// std::forward_list<int> c;
|
||||
// assert ( ii1 != c.cbegin());
|
||||
// assert ( cii != c.begin());
|
||||
// assert ( cii != c.cend());
|
||||
// assert ( ii1 != c.end());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user