cpp-common/bt2: make `UniqueConstError::_mError` a pointer
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 3 Apr 2024 17:07:36 +0000 (13:07 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12235
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
src/cpp-common/bt2/error.hpp

index b9c8c81759848917d28bcecbe5176d4f12b1b176..d4dfeaac25807e75f8ee8febac5d0dc3f31dde3f 100644 (file)
@@ -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
This page took 0.028388 seconds and 4 git commands to generate.