Changeset View
Changeset View
Standalone View
Standalone View
src/serialize.h
Show First 20 Lines • Show All 728 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/** | /** | ||||
* map | * map | ||||
*/ | */ | ||||
template <typename Stream, typename K, typename T, typename Pred, typename A> | template <typename Stream, typename K, typename T, typename Pred, typename A> | ||||
void Serialize(Stream &os, const std::map<K, T, Pred, A> &m) { | void Serialize(Stream &os, const std::map<K, T, Pred, A> &m) { | ||||
WriteCompactSize(os, m.size()); | WriteCompactSize(os, m.size()); | ||||
for (const std::pair<K, T> &p : m) { | for (const auto &entry : m) { | ||||
Serialize(os, p); | Serialize(os, entry); | ||||
} | } | ||||
} | } | ||||
template <typename Stream, typename K, typename T, typename Pred, typename A> | template <typename Stream, typename K, typename T, typename Pred, typename A> | ||||
void Unserialize(Stream &is, std::map<K, T, Pred, A> &m) { | void Unserialize(Stream &is, std::map<K, T, Pred, A> &m) { | ||||
m.clear(); | m.clear(); | ||||
size_t nSize = ReadCompactSize(is); | size_t nSize = ReadCompactSize(is); | ||||
typename std::map<K, T, Pred, A>::iterator mi = m.begin(); | typename std::map<K, T, Pred, A>::iterator mi = m.begin(); | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |