From: David Reiss Date: Tue, 10 Feb 2009 21:38:48 +0000 (+0000) Subject: cpp: Fix implementations of "list" X-Git-Tag: 0.2.0~305 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=035aed90c0a7e54cd9e0f2ac70dc7c1bb303a4b0;p=common%2Fthrift.git cpp: Fix implementations of "list" TProtocol::readBool expects a "bool&" as its argument, but "list" is implemented as "vector", which is a specialization of vector that uses a custom structure as its reference type. Therefore, we need to overload TProtocol::readBool for std::vector::reference. This function is provided as a non-virtual for efficiency since it is highly unlikely that any subclass will want to override it. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@743112 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h index e4cfe0fb..5dcea2b7 100644 --- a/lib/cpp/src/protocol/TProtocol.h +++ b/lib/cpp/src/protocol/TProtocol.h @@ -213,6 +213,12 @@ class TProtocol { virtual uint32_t readBinary(std::string& str) = 0; + uint32_t readBool(std::vector::reference ref) { + bool value; + uint32_t rv = readBool(value); + ref = value; + } + /** * Method to arbitrarily skip over data. */