Page MenuHomePhabricator

Support serialization as another type without casting
ClosedPublic

Authored by markblundeberg on May 5 2019, 18:07.

Details

Summary

Backport of PR12731 (818dc74)

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.

Depends on D2929 and D2931

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.