aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-09 09:30:22 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-09 09:30:22 +0100
commit7482253a6d939b9966ecb5b615ce891131cf55b3 (patch)
tree4fa5ed0391780dd0194d4043b60a9dd65a01faf0 /contrib
parentMerge pull request #2247 (diff)
downloadmonero-7482253a6d939b9966ecb5b615ce891131cf55b3.tar.xz
epee: fixup KV_SERIALIZE_OPT to work in more cases
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/serialization/keyvalue_serialization.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/epee/include/serialization/keyvalue_serialization.h b/contrib/epee/include/serialization/keyvalue_serialization.h
index f4442e46c..d4413a71b 100644
--- a/contrib/epee/include/serialization/keyvalue_serialization.h
+++ b/contrib/epee/include/serialization/keyvalue_serialization.h
@@ -70,10 +70,13 @@ public: \
#define KV_SERIALIZE_N(varialble, val_name) \
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name);
+ template<typename T> inline void serialize_default(const T &t, T v) { }
+ template<typename T> inline void serialize_default(T &t, T v) { t = v; }
+
#define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \
do { \
if (!epee::serialization::selector<is_store>::serialize(this_ref.variable, stg, hparent_section, val_name)) \
- this_ref.variable = default_value; \
+ epee::serialize_default(this_ref.variable, default_value); \
} while (0);
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \