aboutsummaryrefslogtreecommitdiff
path: root/ports/ginkgo/windows-iterator.patch
blob: be6645f37db39333298e561d600623e00030d220 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
diff --git a/core/base/iterator_factory.hpp b/core/base/iterator_factory.hpp
index b7efd21dfe..5e4bddeb17 100644
--- a/core/base/iterator_factory.hpp
+++ b/core/base/iterator_factory.hpp
@@ -110,7 +110,7 @@ class IteratorFactory {
 
         ~Reference() {}
 
-        Reference(IteratorFactory &parent, array_index_type array_index)
+        Reference(IteratorFactory *parent, array_index_type array_index)
             : parent_(parent), arr_index_(array_index)
         {}
 
@@ -143,10 +143,10 @@ class IteratorFactory {
         {
             // In C++11, it is legal for a nested class to access private
             // members of the parent class.
-            parent_.dominant_values_[arr_index_] =
-                std::move(other.parent_.dominant_values_[other.arr_index_]);
-            parent_.secondary_values_[arr_index_] =
-                std::move(other.parent_.secondary_values_[other.arr_index_]);
+            parent_->dominant_values_[arr_index_] =
+                std::move(other.parent_->dominant_values_[other.arr_index_]);
+            parent_->secondary_values_[arr_index_] =
+                std::move(other.parent_->secondary_values_[other.arr_index_]);
             return *this;
         }
 
@@ -174,25 +174,25 @@ class IteratorFactory {
             return left.dominant < right.dominant();
         }
 
-        ToSortType &dominant() { return parent_.dominant_values_[arr_index_]; }
+        ToSortType &dominant() { return parent_->dominant_values_[arr_index_]; }
 
         const ToSortType &dominant() const
         {
-            return parent_.dominant_values_[arr_index_];
+            return parent_->dominant_values_[arr_index_];
         }
 
         SecondaryType &secondary()
         {
-            return parent_.secondary_values_[arr_index_];
+            return parent_->secondary_values_[arr_index_];
         }
 
         const SecondaryType &secondary() const
         {
-            return parent_.secondary_values_[arr_index_];
+            return parent_->secondary_values_[arr_index_];
         }
 
     private:
-        IteratorFactory &parent_;
+        IteratorFactory *parent_;
         array_index_type arr_index_;
     };
 
@@ -214,9 +214,11 @@ class IteratorFactory {
         using reference = Reference;
         using iterator_category = std::random_access_iterator_tag;
 
+        Iterator() = default;
+
         ~Iterator() {}
 
-        Iterator(IteratorFactory &parent, difference_type array_index)
+        Iterator(IteratorFactory *parent, difference_type array_index)
             : parent_(parent), arr_index_(array_index)
         {}
 
@@ -298,12 +300,12 @@ class IteratorFactory {
         }
 
         // Comparable operators
-        bool operator==(const Iterator &other)
+        bool operator==(const Iterator &other) const
         {
             return arr_index_ == other.arr_index_;
         }
 
-        bool operator!=(const Iterator &other)
+        bool operator!=(const Iterator &other) const
         {
             return arr_index_ != other.arr_index_;
         }
@@ -329,8 +331,8 @@ class IteratorFactory {
         }
 
     private:
-        IteratorFactory &parent_;
-        difference_type arr_index_;
+        IteratorFactory *parent_{};
+        difference_type arr_index_{};
     };
 
 public:
@@ -363,7 +365,7 @@ class IteratorFactory {
      * Creates an iterator pointing to the beginning of both arrays
      * @returns  an iterator pointing to the beginning of both arrays
      */
-    Iterator begin() { return {*this, 0}; }
+    Iterator begin() { return {this, 0}; }
 
     /**
      * Creates an iterator pointing to the (excluding) end of both arrays
@@ -371,7 +373,7 @@ class IteratorFactory {
      */
     Iterator end()
     {
-        return {*this, static_cast<typename Iterator::difference_type>(size_)};
+        return {this, static_cast<typename Iterator::difference_type>(size_)};
     }
 
 private: