From 5a139159604a11b44c21518f411b49c795873487 Mon Sep 17 00:00:00 2001 From: mpilman Date: Fri, 10 May 2019 13:14:17 -0700 Subject: [PATCH] implemented std::set serializer for flatbuffers --- flow/flat_buffers.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/flow/flat_buffers.h b/flow/flat_buffers.h index 3a0c7d6a0b..a7ff261358 100644 --- a/flow/flat_buffers.h +++ b/flow/flat_buffers.h @@ -153,6 +153,21 @@ struct vector_like_traits> : std::true_type static iterator begin(const Vec& v) { return v.begin(); } }; +template +struct vector_like_traits> : std::true_type { + using Vec = std::set; + using value_type = Key; + using iterator = typename Vec::const_iterator; + using insert_iterator = std::insert_iterator; + + static size_t num_entries(const Vec& v) { return v.size(); } + template + static void reserve(Vec&, size_t, Context&) {} + + static insert_iterator insert(Vec& v) { return std::inserter(v, v.end()); } + static iterator begin(const Vec& v) { return v.begin(); } +}; + template <> struct dynamic_size_traits : std::true_type { private: