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
Branch
PR12731
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5684
Build 9430: Bitcoin ABC Buildbot (legacy)
Build 9429: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.May 9 2019, 07:28