Fix C++ build
PR #3165 broke the build with c++11.
I split out the compile time fix from https://github.com/apache/thrift/pull/3167/files#diff-d8d7400cdf01511c2ad2df7caf958173c2e96e8633271709c9b0b5cd8e89215c to ensure we have a clean trunk (so I can have other changes on top). I can't take credit for the fixes.
I verified this compiles with gcc, clang (on c++11) and also on clang with c++1z
diff --git a/lib/cpp/src/thrift/Thrift.h b/lib/cpp/src/thrift/Thrift.h
index 3a26ab6..8c330f9 100644
--- a/lib/cpp/src/thrift/Thrift.h
+++ b/lib/cpp/src/thrift/Thrift.h
@@ -54,6 +54,9 @@
public:
using iterator_category = std::forward_iterator_tag;
using value_type = std::pair<int, const char*>;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
TEnumIterator(int n, int* enums, const char** names)
: ii_(0), n_(n), enums_(enums), names_(names) {}
diff --git a/lib/cpp/src/thrift/transport/TSocketUtils.h b/lib/cpp/src/thrift/transport/TSocketUtils.h
index b0916b3..b00fd34 100644
--- a/lib/cpp/src/thrift/transport/TSocketUtils.h
+++ b/lib/cpp/src/thrift/transport/TSocketUtils.h
@@ -65,6 +65,9 @@
struct Iter {
using iterator_category = std::forward_iterator_tag;
using value_type = const addrinfo*;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
value_type ptr = nullptr;