Skip to content

Commit

Permalink
Avoid copy in boost::variant deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Mewes committed Aug 19, 2015
1 parent 87ec495 commit 0911906
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/containers/archive/boost_types.hpp
Expand Up @@ -89,10 +89,9 @@ template <cluster_version_t W, int N, class Variant, class T, class... Ts>
struct variant_deserializer<W, N, Variant, T, Ts...> {
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<W>(s, &v);
*x = T();
archive_result_t res = deserialize<W>(s, boost::get<T>(x));
if (bad(res)) { return res; }
*x = v;

return archive_result_t::SUCCESS;
} else {
Expand Down

0 comments on commit 0911906

Please sign in to comment.