diff options
author | Kazu Hirata <kazu@google.com> | 2025-09-26 08:43:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-26 08:43:48 -0700 |
commit | 88ef27463e56de7b80df5679c90bf32b81b4e104 (patch) | |
tree | b5bdb61cf34ccbb448389c04b0d9573f65702cf7 | |
parent | 6598e313739adf20520c7b904c0cd44d136d1b69 (diff) | |
download | llvm-88ef27463e56de7b80df5679c90bf32b81b4e104.zip llvm-88ef27463e56de7b80df5679c90bf32b81b4e104.tar.gz llvm-88ef27463e56de7b80df5679c90bf32b81b4e104.tar.bz2 |
[ADT] Apply Rule of Five to StringTable::Iterator (#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.
-rw-r--r-- | llvm/include/llvm/ADT/StringTable.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/include/llvm/ADT/StringTable.h b/llvm/include/llvm/ADT/StringTable.h index 575b3c9..9422a6d 100644 --- a/llvm/include/llvm/ADT/StringTable.h +++ b/llvm/include/llvm/ADT/StringTable.h @@ -118,12 +118,8 @@ public: constexpr Iterator(const Iterator &RHS) = default; constexpr Iterator(Iterator &&RHS) = default; - Iterator &operator=(const Iterator &RHS) { - Table = RHS.Table; - O = RHS.O; - S = RHS.S; - return *this; - } + constexpr Iterator &operator=(const Iterator &RHS) = default; + constexpr Iterator &operator=(Iterator &&RHS) = default; bool operator==(const Iterator &RHS) const { assert(Table == RHS.Table && "Compared iterators for unrelated tables!"); |