[PATCH] D56493: [libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same.
Andrey Maksimov via Phabricator
reviews at reviews.llvm.org
Wed Jan 9 07:35:08 PST 2019
amakc11 created this revision.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne.
The unordered_set <http://eel.is/c++draft/unord.set#overview-3> and unordered_multiset <http://eel.is/c++draft/unord.multiset#overview-3> iterators are specified in the standard as follows:
using iterator = implementation-defined; // see [container.requirements]
using const_iterator = implementation-defined; // see [container.requirements]
using local_iterator = implementation-defined; // see [container.requirements]
using const_local_iterator = implementation-defined; // see [container.requirements]
The pairs iterator/const_iterator and local_iterator/const_local_iterator are not required to be the same. The reasonable requirement <http://eel.is/c++draft/container.requirements#general-4> would be that iterator can convert to const_iterator and local_iterator can convert to const_local_iterator. This patch weakens the check and makes the test more portable.
Repository:
rCXX libc++
https://reviews.llvm.org/D56493
Files:
test/std/containers/unord/iterator_difference_type.pass.cpp
Index: test/std/containers/unord/iterator_difference_type.pass.cpp
===================================================================
--- test/std/containers/unord/iterator_difference_type.pass.cpp
+++ test/std/containers/unord/iterator_difference_type.pass.cpp
@@ -52,10 +52,10 @@
template <class Set, class ValueTp, class CPtrT>
void testUnorderedSet() {
- static_assert((std::is_same<typename Set::iterator,
- typename Set::const_iterator>::value), "");
- static_assert((std::is_same<typename Set::local_iterator,
- typename Set::const_local_iterator>::value), "");
+ static_assert((std::is_convertible<typename Set::iterator,
+ typename Set::const_iterator>::value), "");
+ static_assert((std::is_convertible<typename Set::local_iterator,
+ typename Set::const_local_iterator>::value), "");
typedef typename Set::difference_type Diff;
{
typedef typename Set::iterator It;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56493.180838.patch
Type: text/x-patch
Size: 1024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190109/aacb9a3c/attachment.bin>
More information about the libcxx-commits
mailing list