From: Simon Marchi Date: Wed, 3 Apr 2024 17:07:36 +0000 (-0400) Subject: cpp-common/bt2: make `UniqueConstError::_mError` a pointer X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=4e586d5ede1b74878a6c446c7e9b3b79cc5510c6;p=babeltrace.git 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 --- 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