aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-07-18 17:52:43 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-07-19 16:16:37 -0700
commit84547fa6d408bdda1685f6d5972232bb19d97a7d (patch)
tree2ff4d9ba84086f1e1d9fab2206893d6b5cfe25f1 /src/serialize.h
parent4a3e8c5aa6a5d8dda15a76d644b2a9f0f40cdec7 (diff)
Avoid creating a temporary vector for size-prefixed elements
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/serialize.h b/src/serialize.h
index df3b47ba87..627225b6ef 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -991,4 +991,12 @@ size_t GetSerializeSize(const S& s, const T& t)
return (CSizeComputer(s.GetType(), s.GetVersion()) << t).size();
}
+template <typename S, typename... T>
+size_t GetSerializeSizeMany(const S& s, const T&... t)
+{
+ CSizeComputer sc(s.GetType(), s.GetVersion());
+ SerializeMany(sc, t...);
+ return sc.size();
+}
+
#endif // BITCOIN_SERIALIZE_H