From 818dc74ba2745872fd68d2158380fc8bd331210e Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 7 Jul 2017 16:06:56 -0700 Subject: Support serialization as another type without casting This adds a READWRITEAS(type, obj) macro which serializes obj as if it were casted to (const type&) when const, and to (type&) when non-const. This makes it usable in serialization code that uses a single implementation for both serialization and deserializing, which doesn't know the constness of the object involved. --- src/addrman.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/addrman.h') diff --git a/src/addrman.h b/src/addrman.h index 67423c6c55..3f163dab65 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -59,7 +59,7 @@ public: template inline void SerializationOp(Stream& s, Operation ser_action) { - READWRITE(*static_cast(this)); + READWRITEAS(CAddress, *this); READWRITE(source); READWRITE(nLastSuccess); READWRITE(nAttempts); -- cgit v1.2.3