bitcoin/bitcoin — pull request #4508 by sipa (2014-07-10 18:19:53+00:00)
Title: Break up CAddrMan's IMPLEMENT_SERIALIZE

clang-format cannot deal with it, and, admittedly, it's way too big anyway.

In order not to duplicate the writing logic for computing the size, introduce a CSizeComputer in serialize.h: a minimal serializer stream implementation that only computes the number of bytes written. Due to inlining, this should be as efficient as the existing GetSerializeSize code.

I'm thinking about getting rid of IMPLEMENT_SERIALIZE entirely, and replace it with one generic method that depending on template instantiation can do either read/write/size.