Skip to content

Commit 1da155f

Browse files
committed
Change signature of StrongIdIterator operators to ensure each instantiation gets a different set
Fixes build error with LLVM 21 due to redefinition of iterator operators
1 parent 94f671d commit 1da155f

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

libs/libvtrutil/src/vtr_strong_id_range.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ class StrongIdIterator {
9696
}
9797

9898
///@brief ~ operator
99-
template<typename IdType>
100-
ssize_t operator-(const StrongIdIterator<IdType>& other) const {
99+
ssize_t operator-(const StrongIdIterator<StrongType>& other) const {
101100
VTR_ASSERT_SAFE(bool(id_));
102101
VTR_ASSERT_SAFE(bool(other.id_));
103102

@@ -107,20 +106,17 @@ class StrongIdIterator {
107106
}
108107

109108
///@brief == operator
110-
template<typename IdType>
111-
bool operator==(const StrongIdIterator<IdType>& other) const {
109+
bool operator==(const StrongIdIterator<StrongType>& other) const {
112110
return id_ == other.id_;
113111
}
114112

115113
///@brief != operator
116-
template<typename IdType>
117-
bool operator!=(const StrongIdIterator<IdType>& other) const {
114+
bool operator!=(const StrongIdIterator<StrongType>& other) const {
118115
return id_ != other.id_;
119116
}
120117

121118
///@brief < operator
122-
template<typename IdType>
123-
bool operator<(const StrongIdIterator<IdType>& other) const {
119+
bool operator<(const StrongIdIterator<StrongType>& other) const {
124120
return id_ < other.id_;
125121
}
126122

@@ -129,19 +125,17 @@ class StrongIdIterator {
129125
};
130126

131127
///@brief + operator
132-
template<typename IdType>
133-
inline StrongIdIterator<IdType> operator+(
134-
const StrongIdIterator<IdType>& lhs,
128+
inline StrongIdIterator<StrongType> operator+(
129+
const StrongIdIterator<StrongType>& lhs,
135130
ssize_t n) {
136131
StrongIdIterator ret = lhs;
137132
ret += n;
138133
return ret;
139134
}
140135

141136
///@brief - operator
142-
template<typename IdType>
143-
inline StrongIdIterator<IdType> operator-(
144-
const StrongIdIterator<IdType>& lhs,
137+
inline StrongIdIterator<StrongType> operator-(
138+
const StrongIdIterator<StrongType>& lhs,
145139
ssize_t n) {
146140
StrongIdIterator ret = lhs;
147141
ret -= n;

0 commit comments

Comments
 (0)