From 4e586d5ede1b74878a6c446c7e9b3b79cc5510c6 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 3 Apr 2024 13:07:36 -0400 Subject: [PATCH] cpp-common/bt2: make `UniqueConstError::_mError` a pointer Make this field a pointer instead of a reference, in order to make `UniqueConstError` assignable. I don't really have a need for this, but it seems more correct. Change-Id: I29ae7a7380f75fa6b680116168a309e70c381f11 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12235 Reviewed-by: Philippe Proulx Tested-by: jenkins --- src/cpp-common/bt2/error.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp-common/bt2/error.hpp b/src/cpp-common/bt2/error.hpp index b9c8c817..d4dfeaac 100644 --- a/src/cpp-common/bt2/error.hpp +++ b/src/cpp-common/bt2/error.hpp @@ -219,7 +219,7 @@ class ConstErrorIterator final private: explicit ConstErrorIterator(const UniqueConstError& error, const std::uint64_t index) noexcept : - _mError {error}, _mIndex {index} + _mError {&error}, _mIndex {index} { } @@ -257,7 +257,7 @@ public: } private: - const UniqueConstError& _mError; + const UniqueConstError *_mError; std::uint64_t _mIndex; }; @@ -321,7 +321,7 @@ private: inline ConstErrorCause ConstErrorIterator::operator*() const noexcept { - return _mError[_mIndex]; + return (*_mError)[_mIndex]; } inline UniqueConstError takeCurrentThreadError() noexcept -- 2.34.1