From ead1091ef84848d7d75217d92d5451257812be93 Mon Sep 17 00:00:00 2001 From: AlexandreSinger Date: Mon, 5 Aug 2024 09:48:21 -0400 Subject: [PATCH] [Warnings] Fixed Const Reference When a class returns a reference to a dereferenced pointer, if the pointer does not point to a const object, returning that pointer as a const has no effect. This was causing warnings. To fix this, we want a refernece to a const object not a const reference to an object (silly, I know). So we need to make this more clear in the class. --- libs/EXTERNAL/libtatum/libtatum/tatum/tags/TimingTags.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/EXTERNAL/libtatum/libtatum/tatum/tags/TimingTags.hpp b/libs/EXTERNAL/libtatum/libtatum/tatum/tags/TimingTags.hpp index afab50fb1be..e24765afa7b 100644 --- a/libs/EXTERNAL/libtatum/libtatum/tatum/tags/TimingTags.hpp +++ b/libs/EXTERNAL/libtatum/libtatum/tatum/tags/TimingTags.hpp @@ -113,6 +113,7 @@ class TimingTags { using value_type = T; using pointer = T*; using reference = T&; + using const_reference = const T&; Iterator(): p_(nullptr) {} Iterator(pointer p): p_(p) {} @@ -123,7 +124,7 @@ class TimingTags { friend bool operator!=(Iterator a, Iterator b) { return a.p_ != b.p_; } reference operator*() { return *p_; } - const reference operator*() const { return *p_; } //Required for MSVC (gcc/clang are fine with only the non-cost version) + const_reference operator*() const { return *p_; } //Required for MSVC (gcc/clang are fine with only the non-cost version) pointer operator->() { return p_; } reference operator[](size_t n) { return *(p_ + n); }