diff options
-rw-r--r-- | framework/src/errors.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/framework/src/errors.h b/framework/src/errors.h index d95272da..4249cf8d 100644 --- a/framework/src/errors.h +++ b/framework/src/errors.h | |||
@@ -122,7 +122,11 @@ protected: | |||
122 | // | 122 | // |
123 | // If overloaded, this will call `mValue.operator=(other.mValue);`, but | 123 | // If overloaded, this will call `mValue.operator=(other.mValue);`, but |
124 | // since we're in the constructor, mValue is not initialized. This can | 124 | // since we're in the constructor, mValue is not initialized. This can |
125 | // cause big issues if the Type is not trivially (move) assignable. | 125 | // cause big issues if `Type` / `Error` is not trivially (move) |
126 | // assignable. | ||
127 | // | ||
128 | // And so, the placement new allows us to call the constructor of | ||
129 | // `Type` or `Error` instead of its assignment operator. | ||
126 | if (mIsValue) { | 130 | if (mIsValue) { |
127 | new (std::addressof(mValue)) Type(other.mValue); | 131 | new (std::addressof(mValue)) Type(other.mValue); |
128 | } else { | 132 | } else { |