From fdbc0a0a5f3a7c0a1baffc2188fe901ccf397338 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Fri, 9 Mar 2018 11:35:25 +0100 Subject: Elaborate just a bit more --- framework/src/errors.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'framework/src/errors.h') 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: // // If overloaded, this will call `mValue.operator=(other.mValue);`, but // since we're in the constructor, mValue is not initialized. This can - // cause big issues if the Type is not trivially (move) assignable. + // cause big issues if `Type` / `Error` is not trivially (move) + // assignable. + // + // And so, the placement new allows us to call the constructor of + // `Type` or `Error` instead of its assignment operator. if (mIsValue) { new (std::addressof(mValue)) Type(other.mValue); } else { -- cgit v1.2.3