[libcxx-commits] [libcxx] r352083 - [libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 24 11:09:22 PST 2019
Author: ldionne
Date: Thu Jan 24 11:09:22 2019
New Revision: 352083
URL: http://llvm.org/viewvc/llvm-project?rev=352083&view=rev
Log:
[libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same
The unordered_set and unordered_multiset 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 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.
Reviewed as https://reviews.llvm.org/D56493.
Thanks to Andrey Maksimov for the patch.
Modified:
libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
Modified: libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp?rev=352083&r1=352082&r2=352083&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp Thu Jan 24 11:09:22 2019
@@ -51,10 +51,10 @@ void testUnorderedMap() {
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;
More information about the libcxx-commits
mailing list