File tree Expand file tree Collapse file tree 2 files changed +55
-12
lines changed Expand file tree Collapse file tree 2 files changed +55
-12
lines changed Original file line number Diff line number Diff line change @@ -646,12 +646,7 @@ public:
646
646
using reference = value_type&;
647
647
using pointer = __rebind_pointer_t <_NodePtr, value_type>;
648
648
649
- _LIBCPP_HIDE_FROM_ABI __tree_iterator () _NOEXCEPT
650
- #if _LIBCPP_STD_VER >= 14
651
- : __ptr_(nullptr )
652
- #endif
653
- {
654
- }
649
+ _LIBCPP_HIDE_FROM_ABI __tree_iterator () _NOEXCEPT : __ptr_(nullptr ) {}
655
650
656
651
_LIBCPP_HIDE_FROM_ABI reference operator *() const { return __get_np ()->__value_ ; }
657
652
_LIBCPP_HIDE_FROM_ABI pointer operator ->() const { return pointer_traits<pointer>::pointer_to (__get_np ()->__value_ ); }
@@ -720,12 +715,7 @@ public:
720
715
using reference = const value_type&;
721
716
using pointer = __rebind_pointer_t <_NodePtr, const value_type>;
722
717
723
- _LIBCPP_HIDE_FROM_ABI __tree_const_iterator () _NOEXCEPT
724
- #if _LIBCPP_STD_VER >= 14
725
- : __ptr_(nullptr )
726
- #endif
727
- {
728
- }
718
+ _LIBCPP_HIDE_FROM_ABI __tree_const_iterator () _NOEXCEPT : __ptr_(nullptr ) {}
729
719
730
720
private:
731
721
typedef __tree_iterator<_Tp, __node_pointer, difference_type> __non_const_iterator;
Original file line number Diff line number Diff line change
1
+ // ===----------------------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ // UNSUPPORTED: c++03
10
+
11
+ // Make sure that that the iterator types of the associative containers is initialized even when default initialized.
12
+ // This is an extension because the standard only requires initialization when an iterator is value initialized, and
13
+ // that only since C++14. We guarantee that iterators are always initialized, even in C++11.
14
+
15
+ #include < cassert>
16
+ #include < map>
17
+ #include < set>
18
+
19
+ template <class Iter >
20
+ void test () {
21
+ {
22
+ Iter iter1;
23
+ Iter iter2;
24
+ assert (iter1 == iter2);
25
+ }
26
+ {
27
+ Iter iter1;
28
+ Iter iter2{};
29
+ assert (iter1 == iter2);
30
+ }
31
+ {
32
+ Iter iter1{};
33
+ Iter iter2;
34
+ assert (iter1 == iter2);
35
+ }
36
+ }
37
+
38
+ template <class Container >
39
+ void test_container () {
40
+ test<typename Container::iterator>();
41
+ test<typename Container::const_iterator>();
42
+ test<typename Container::reverse_iterator>();
43
+ test<typename Container::const_reverse_iterator>();
44
+ }
45
+
46
+ int main (int , char **) {
47
+ test_container<std::map<int , int >>();
48
+ test_container<std::multimap<int , int >>();
49
+ test_container<std::set<int >>();
50
+ test_container<std::multiset<int >>();
51
+
52
+ return 0 ;
53
+ }
You can’t perform that action at this time.
0 commit comments