aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/serialize.h b/src/serialize.h
index c0666d30a5..6eefa18135 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -38,12 +38,12 @@ inline T& REF(const T& val)
return const_cast<T&>(val);
}
-// Used to acquire a const pointer "this" and generate a const
-// serialization operation from a template
+// Used to acquire a non-const pointer "this" to generate bodies
+// of const serialization operations from a template
template<typename T>
-inline T MAKE_CONST(T val)
+inline T* NCONST_PTR(const T* val)
{
- return const_cast<const T>(val);
+ return const_cast<T*>(val);
}
/** Get begin pointer of vector (non-const version).
@@ -97,15 +97,15 @@ enum
#define IMPLEMENT_SERIALIZE \
size_t GetSerializeSize(int nType, int nVersion) const { \
ser_streamplaceholder s; \
- return SerializationOp(MAKE_CONST(this), s, CSerActionGetSerializeSize(), nType, nVersion); \
+ return NCONST_PTR(this)->SerializationOp(s, CSerActionGetSerializeSize(), nType, nVersion); \
} \
template<typename Stream> \
void Serialize(Stream& s, int nType, int nVersion) const { \
- SerializationOp(MAKE_CONST(this), s, CSerActionSerialize(), nType, nVersion); \
+ NCONST_PTR(this)->SerializationOp(s, CSerActionSerialize(), nType, nVersion); \
} \
template<typename Stream> \
void Unserialize(Stream& s, int nType, int nVersion) { \
- SerializationOp(this, s, CSerActionUnserialize(), nType, nVersion); \
+ SerializationOp(s, CSerActionUnserialize(), nType, nVersion); \
}