Fix typo in the in place std::variant<> extension

We of course want to do this for non-trivial types as mentioned in the
comment above, not for trivial types...
This commit is contained in:
Robbert van der Helm
2021-05-28 14:17:35 +02:00
parent f533dd40ce
commit b4c9f53bcf
+1 -1
View File
@@ -51,7 +51,7 @@ class InPlaceVariant : public StdVariant<Overloads...> {
// Reinitializing nontrivial types may be expensive especially when
// they reference heap data, so if `data` is already holding the
// requested variant then we'll deserialize into the existing object
if constexpr (std::is_trivial_v<TElem>) {
if constexpr (!std::is_trivial_v<TElem>) {
if (auto item = std::get_if<TElem>(&data)) {
this->serializeType(des, *item);
return;