diff --git a/serialization_visitors.hh b/serialization_visitors.hh index 4a7b121404..db6f25146a 100644 --- a/serialization_visitors.hh +++ b/serialization_visitors.hh @@ -96,14 +96,4 @@ inline void skip(seastar::simple_input_stream& v, boost::type) { v.skip(deserialize(v, boost::type())); } -template -inline void skip(seastar::simple_input_stream& v, boost::type>) { - auto ln = deserialize(v, boost::type()); - for (size_type i = 0; i < ln; i++) { - skip(v, boost::type()); - } } - - -} - diff --git a/serializer.hh b/serializer.hh index 216c22327d..a71b288dc3 100644 --- a/serializer.hh +++ b/serializer.hh @@ -91,12 +91,6 @@ inline T deserialize(Input& in, boost::type t) { return serializer::read(in); }; -// For vectors -template -inline void serialize(Output& out, const std::vector& v); -template -inline std::vector deserialize(Input& in, boost::type>); - template inline void serialize(Output& out, const std::array& v); template diff --git a/serializer_impl.hh b/serializer_impl.hh index 006b2b7618..43d4a9273e 100644 --- a/serializer_impl.hh +++ b/serializer_impl.hh @@ -138,19 +138,29 @@ static inline void deserialize_array(Input& in, Container& v, size_t sz) { deserialize_array_helper(), T>::doit(in, v, sz); } -template -inline void serialize(Output& out, const std::vector& v) { - safe_serialize_as_uint32(out, v.size()); - serialize_array(out, v); -} -template -inline std::vector deserialize(Input& in, boost::type>) { - auto sz = deserialize(in, boost::type()); - std::vector v; - v.reserve(sz); - deserialize_array(in, v, sz); - return v; -} +template +struct serializer> { + template + static std::vector read(Input& in) { + auto sz = deserialize(in, boost::type()); + std::vector v; + v.reserve(sz); + deserialize_array(in, v, sz); + return v; + } + template + static void write(Output& out, const std::vector& v) { + safe_serialize_as_uint32(out, v.size()); + serialize_array(out, v); + } + template + static void skip(Input& in) { + auto ln = deserialize(in, boost::type()); + for (size_type i = 0; i < ln; i++) { + serializer::skip(in); + } + } +}; template inline void serialize(Output& out, const std::chrono::duration& d) {