aboutsummaryrefslogtreecommitdiff
path: root/src/serialization/vector.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-10 22:30:08 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-09-25 21:16:32 +0100
commit493fad80532bb0e2c12e0f77d79d5a31c0627139 (patch)
tree9470dfb1d773a595053e27f1d6a6ed89406b4ca6 /src/serialization/vector.h
parentfix typo in basic and core CMakeLists.txt (diff)
downloadmonero-493fad80532bb0e2c12e0f77d79d5a31c0627139.tar.xz
serialization: add deque serialization
Diffstat (limited to '')
-rw-r--r--src/serialization/vector.h19
1 files changed, 17 insertions, 2 deletions
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<false> &ar, std::vector<T> &v);
template <template <bool> class Archive, class T>
bool do_serialize(Archive<true> &ar, std::vector<T> &v);
+template <template <bool> class Archive, class T>
+bool do_serialize(Archive<false> &ar, std::deque<T> &v);
+template <template <bool> class Archive, class T>
+bool do_serialize(Archive<true> &ar, std::deque<T> &v);
+
namespace serialization
{
namespace detail
@@ -64,7 +69,7 @@ namespace serialization
}
template <template <bool> class Archive, class T>
-bool do_serialize(Archive<false> &ar, std::vector<T> &v)
+bool do_serialize_vd(Archive<false> &ar, T &v)
{
size_t cnt;
ar.begin_array(cnt);
@@ -93,7 +98,7 @@ bool do_serialize(Archive<false> &ar, std::vector<T> &v)
}
template <template <bool> class Archive, class T>
-bool do_serialize(Archive<true> &ar, std::vector<T> &v)
+bool do_serialize_vd(Archive<true> &ar, T &v)
{
size_t cnt = v.size();
ar.begin_array(cnt);
@@ -110,3 +115,13 @@ bool do_serialize(Archive<true> &ar, std::vector<T> &v)
ar.end_array();
return true;
}
+
+template <template <bool> class Archive, class T>
+bool do_serialize(Archive<false> &ar, std::vector<T> &v) { return do_serialize_vd(ar, v); }
+template <template <bool> class Archive, class T>
+bool do_serialize(Archive<true> &ar, std::vector<T> &v) { return do_serialize_vd(ar, v); }
+
+template <template <bool> class Archive, class T>
+bool do_serialize(Archive<false> &ar, std::deque<T> &v) { return do_serialize_vd(ar, v); }
+template <template <bool> class Archive, class T>
+bool do_serialize(Archive<true> &ar, std::deque<T> &v) { return do_serialize_vd(ar, v); }