From 493fad80532bb0e2c12e0f77d79d5a31c0627139 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 10 Sep 2017 22:30:08 +0100 Subject: serialization: add deque serialization --- src/serialization/serialization.h | 17 +++++++++++++++++ src/serialization/vector.h | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/serialization/serialization.h b/src/serialization/serialization.h index 639240820..869f5d10e 100644 --- a/src/serialization/serialization.h +++ b/src/serialization/serialization.h @@ -41,6 +41,7 @@ #pragma once #include +#include #include #include #include @@ -198,6 +199,11 @@ inline bool do_serialize(Archive &ar, bool &v) #define PREPARE_CUSTOM_VECTOR_SERIALIZATION(size, vec) \ ::serialization::detail::prepare_custom_vector_serialization(size, vec, typename Archive::is_saving()) +/*! \macro PREPARE_CUSTOM_DEQUE_SERIALIZATION + */ +#define PREPARE_CUSTOM_DEQUE_SERIALIZATION(size, vec) \ + ::serialization::detail::prepare_custom_deque_serialization(size, vec, typename Archive::is_saving()) + /*! \macro END_SERIALIZE * \brief self-explanatory */ @@ -292,6 +298,17 @@ namespace serialization { vec.resize(size); } + template + void prepare_custom_deque_serialization(size_t size, std::deque& vec, const boost::mpl::bool_& /*is_saving*/) + { + } + + template + void prepare_custom_deque_serialization(size_t size, std::deque& vec, const boost::mpl::bool_& /*is_saving*/) + { + vec.resize(size); + } + /*! \fn do_check_stream_state * * \brief self explanatory diff --git a/src/serialization/vector.h b/src/serialization/vector.h index 598cfb92e..12fd59558 100644 --- a/src/serialization/vector.h +++ b/src/serialization/vector.h @@ -37,6 +37,11 @@ bool do_serialize(Archive &ar, std::vector &v); template