aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-04-10 19:56:22 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-04-10 20:54:33 +0200
commit0a8054e7cd5c76d01e4ac7234e3883d05f6f5fdd (patch)
treeff45a44e6f9bf3a76df3f5f23a80208b550d7a96 /src/txdb.h
parenta84b056d5f1bc28b08937af3485124e68bb93024 (diff)
parent818dc74ba2745872fd68d2158380fc8bd331210e (diff)
downloadbitcoin-0a8054e7cd5c76d01e4ac7234e3883d05f6f5fdd.tar.xz
Merge #12731: Support serialization as another type without casting
818dc74 Support serialization as another type without casting (Pieter Wuille) Pull request description: This adds a `READWRITEAS(type, obj)` macro which serializes `obj` as if it were converted to `const type&` when `const`, and to `type&` when non-`const`. No actual cast is involved, so this only works when this conversion can be done automatically. 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. This is a redo of #12712, using a slightly different interface. Tree-SHA512: 262f0257284ff99b5ffaec9b997c194e221522ba35c3ac8eaa9bb344449d7ea0a314de254dc77449fa7aaa600f8cd9a24da65aade8c1ec6aa80c6e9a7bba5ca7
Diffstat (limited to 'src/txdb.h')
-rw-r--r--src/txdb.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/txdb.h b/src/txdb.h
index ad76b3257d..f3454e7d09 100644
--- a/src/txdb.h
+++ b/src/txdb.h
@@ -47,7 +47,7 @@ struct CDiskTxPos : public CDiskBlockPos
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
- READWRITE(*static_cast<CDiskBlockPos*>(this));
+ READWRITEAS(CDiskBlockPos, *this);
READWRITE(VARINT(nTxOffset));
}