mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-07 03:03:58 +01:00
Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid of the specialized GetSerializeSize methods everywhere, and just use CSizeComputer. This removes a lot of code which isn't actually used anywhere. For CCompactSize and CVarInt this actually removes a more efficient size computing algorithm, which is brought back in a later commit.
This commit is contained in:
@@ -308,13 +308,6 @@ public:
|
||||
s.write((char*)&vch[0], vch.size() * sizeof(vch[0]));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned int GetSerializeSize(const T& obj)
|
||||
{
|
||||
// Tells the size of the object if serialized to this stream
|
||||
return ::GetSerializeSize(obj, nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
CDataStream& operator<<(const T& obj)
|
||||
{
|
||||
@@ -457,13 +450,6 @@ public:
|
||||
throw std::ios_base::failure("CAutoFile::write: write failed");
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
unsigned int GetSerializeSize(const T& obj)
|
||||
{
|
||||
// Tells the size of the object if serialized to this stream
|
||||
return ::GetSerializeSize(obj, nType, nVersion);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
CAutoFile& operator<<(const T& obj)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user