HomePhabricator

[backport#17850] Introduce new serialization macros without casts

Description

[backport#17850] Introduce new serialization macros without casts

Summary:

This new approach uses a static method which takes the object as
a argument. This has the advantage that its constness can be a
template parameter, allowing a single implementation that sees the
object as const for serialization and non-const for deserialization,
without casts.

More boilerplate is included in the new macro as well.

This is a backport of Core PR17850 [1/2]
Commit https://github.com/bitcoin/bitcoin/pull/17850/commits/ca33451535dc29f64d37c49af8b22142d7716d0d

Test Plan: ninja

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8391

Details

Provenance
Pieter Wuille <pieter.wuille@gmail.com>Authored on Jul 7 2017, 22:48
PiRKCommitted on Nov 13 2020, 14:54
PiRKPushed on Nov 13 2020, 14:54
Reviewer
Restricted Project
Differential Revision
D8391: [backport#17850] Introduce new serialization macros without casts
Parents
rABC39bcc7aeb41b: net: Log to net category for exceptions in ProcessMessages
Branches
Unknown
Tags
Unknown