From 091190627e65e72e8343208d5b8be12326945077 Mon Sep 17 00:00:00 2001 From: Daniel Mewes Date: Wed, 19 Aug 2015 00:31:45 -0700 Subject: [PATCH] Avoid copy in boost::variant deserialization --- src/containers/archive/boost_types.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/containers/archive/boost_types.hpp b/src/containers/archive/boost_types.hpp index 696330a9f31..924614680ff 100644 --- a/src/containers/archive/boost_types.hpp +++ b/src/containers/archive/boost_types.hpp @@ -89,10 +89,9 @@ template struct variant_deserializer { static MUST_USE archive_result_t deserialize_variant(int n, read_stream_t *s, Variant *x) { if (n == N) { - T v; - archive_result_t res = deserialize(s, &v); + *x = T(); + archive_result_t res = deserialize(s, boost::get(x)); if (bad(res)) { return res; } - *x = v; return archive_result_t::SUCCESS; } else {