THRIFT-922. cpp: Fix C++ compilation when using list<bool>
authorDavid Reiss <dreiss@apache.org>
Wed, 6 Oct 2010 17:09:58 +0000 (17:09 +0000)
committerDavid Reiss <dreiss@apache.org>
Wed, 6 Oct 2010 17:09:58 +0000 (17:09 +0000)
commit8dfc732af635d5243194b74d4f411a551ff9a5ee
tree75dfa730b6c7b66efa544f5daf1d51636e5cae99
parente71115be6caa2f3afd6fa092a09fd41c2c355691
THRIFT-922. cpp: Fix C++ compilation when using list<bool>

The STL specializes vector<bool> to store the values as individual bits, rather
than bools.  Therefore, when using a Thrift list<bool>, readBool() gets invoked
not with a bool&, but with a std::vector<bool>::reference.

TProtocol does provide a readBool(std::vector<bool>::reference) implementation.
However, almost all TProtocol subclasses defined only readBool(bool&), which
hides the other overloaded versions of readBool().  As a result, the code
worked only when accessing TProtocol objects via a "TProtocol*", and not
directly via the subclass type.  When using C++ templates, protocol objects do
get invoked via pointers to the subclass type, causing compile failures when
std::vector<bool> is used.

This change updates the various TProtocol implementations to also provide
readBool(std::vector<bool>::reference).

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005137 13f79535-47bb-0310-9956-ffa450edef68
lib/cpp/src/protocol/TBinaryProtocol.h
lib/cpp/src/protocol/TCompactProtocol.h
lib/cpp/src/protocol/TDenseProtocol.h
lib/cpp/src/protocol/TJSONProtocol.h
lib/cpp/src/protocol/TProtocol.h
lib/cpp/src/protocol/TProtocolTap.h
lib/cpp/src/protocol/TVirtualProtocol.h