Skip to content

Commit cc5ea2a

Browse files
kazutakahiratamahesh-attarde
authored andcommitted
[ADT] Apply Rule of Five to StringTable::Iterator (llvm#160815)
StringTable::Iterator has a user-defined copy assignment operator, a defaulted copy constructor, and a defaulted move constructor. This patch makes the copy assignment operator defaulted and adds a defaulted move assignment operator to adhere to the Rule of Five while making the operators constexpr.
1 parent 97aa932 commit cc5ea2a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/include/llvm/ADT/StringTable.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,8 @@ class StringTable {
118118
constexpr Iterator(const Iterator &RHS) = default;
119119
constexpr Iterator(Iterator &&RHS) = default;
120120

121-
Iterator &operator=(const Iterator &RHS) {
122-
Table = RHS.Table;
123-
O = RHS.O;
124-
S = RHS.S;
125-
return *this;
126-
}
121+
constexpr Iterator &operator=(const Iterator &RHS) = default;
122+
constexpr Iterator &operator=(Iterator &&RHS) = default;
127123

128124
bool operator==(const Iterator &RHS) const {
129125
assert(Table == RHS.Table && "Compared iterators for unrelated tables!");

0 commit comments

Comments
 (0)