mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-21 06:40:06 +08:00
[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. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -51,10 +51,10 @@ void testUnorderedMap() {
|
|||||||
|
|
||||||
template <class Set, class ValueTp, class CPtrT>
|
template <class Set, class ValueTp, class CPtrT>
|
||||||
void testUnorderedSet() {
|
void testUnorderedSet() {
|
||||||
static_assert((std::is_same<typename Set::iterator,
|
static_assert((std::is_convertible<typename Set::iterator,
|
||||||
typename Set::const_iterator>::value), "");
|
typename Set::const_iterator>::value), "");
|
||||||
static_assert((std::is_same<typename Set::local_iterator,
|
static_assert((std::is_convertible<typename Set::local_iterator,
|
||||||
typename Set::const_local_iterator>::value), "");
|
typename Set::const_local_iterator>::value), "");
|
||||||
typedef typename Set::difference_type Diff;
|
typedef typename Set::difference_type Diff;
|
||||||
{
|
{
|
||||||
typedef typename Set::iterator It;
|
typedef typename Set::iterator It;
|
||||||
|
Reference in New Issue
Block a user