[tint][utils] Add missing const to Slice equality operator Change-Id: Iff5cc9761e26e7668cdfbc75f581203b54c88227 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/174282 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/utils/containers/slice.h b/src/tint/utils/containers/slice.h index 3c60913..89afcb1 100644 --- a/src/tint/utils/containers/slice.h +++ b/src/tint/utils/containers/slice.h
@@ -276,14 +276,14 @@ /// Equality operator. /// @param other the other slice to compare against /// @returns true if all fields of this slice are equal to the fields of @p other - bool operator==(const Slice& other) { + bool operator==(const Slice& other) const { return data == other.data && len == other.len && cap == other.cap; } /// Inequality operator. /// @param other the other slice to compare against /// @returns false if any fields of this slice are not equal to the fields of @p other - bool operator!=(const Slice& other) { return !(*this == other); } + bool operator!=(const Slice& other) const { return !(*this == other); } }; /// Deduction guide for Slice from c-array
diff --git a/src/tint/utils/containers/slice_test.cc b/src/tint/utils/containers/slice_test.cc index 01932fd..5e30d4e 100644 --- a/src/tint/utils/containers/slice_test.cc +++ b/src/tint/utils/containers/slice_test.cc
@@ -206,7 +206,7 @@ TEST(TintSliceTest, Equality) { int elements[] = {1, 2, 3}; - auto a = Slice{elements}; + const auto a = Slice{elements}; { auto b = a; EXPECT_TRUE(a == b);