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
diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h
index 4b05de2..3c06bf5 100644
--- a/lib/cpp/src/protocol/TProtocol.h
+++ b/lib/cpp/src/protocol/TProtocol.h
@@ -30,6 +30,7 @@
 #include <sys/types.h>
 #include <string>
 #include <map>
+#include <vector>
 
 
 // Use this to get around strict aliasing rules.
@@ -493,6 +494,8 @@
 
   virtual uint32_t readBool_virt(bool& value) = 0;
 
+  virtual uint32_t readBool_virt(std::vector<bool>::reference value) = 0;
+
   virtual uint32_t readByte_virt(int8_t& byte) = 0;
 
   virtual uint32_t readI16_virt(int16_t& i16) = 0;
@@ -611,11 +614,14 @@
     return readBinary_virt(str);
   }
 
-  uint32_t readBool(std::vector<bool>::reference ref) {
-    bool value;
-    uint32_t rv = readBool(value);
-    ref = value;
-    return rv;
+  /*
+   * std::vector is specialized for bool, and its elements are individual bits
+   * rather than bools.   We need to define a different version of readBool()
+   * to work with std::vector<bool>.
+   */
+  uint32_t readBool(std::vector<bool>::reference value) {
+    T_VIRTUAL_CALL();
+    return readBool_virt(value);
   }
 
   /**