Make the CDC connector C++0x compliant

As CentOS 6 is supported, the CDC connector ought to build on non-C++11
systems.
This commit is contained in:
Markus Mäkelä
2018-01-24 10:55:16 +02:00
parent ed81757c04
commit 522cbab23d
2 changed files with 9 additions and 8 deletions

View File

@ -120,7 +120,8 @@ template <class T> class Closer
public: public:
Closer(T t): Closer(T t):
m_t(t) m_t(t),
m_close(false)
{ {
} }
@ -147,9 +148,9 @@ public:
private: private:
T m_t; T m_t;
bool m_close = true; bool m_close;
void close(T t) = delete; void close(T t);
}; };
template <> void Closer<struct addrinfo*>::close(struct addrinfo* ai) template <> void Closer<struct addrinfo*>::close(struct addrinfo* ai)
@ -314,8 +315,8 @@ static inline bool is_schema(json_t* json)
void Connection::process_schema(json_t* json) void Connection::process_schema(json_t* json)
{ {
SValueVector keys(std::make_shared<ValueVector>()); SValueVector keys(new ValueVector);
SValueVector types(std::make_shared<ValueVector>()); SValueVector types(new ValueVector);
json_t* arr = json_object_get(json, "fields"); json_t* arr = json_object_get(json, "fields");
size_t i; size_t i;

View File

@ -19,7 +19,7 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <memory> #include <tr1/memory>
#include <vector> #include <vector>
#include <map> #include <map>
#include <algorithm> #include <algorithm>
@ -34,10 +34,10 @@ const char* TIMEOUT = "Request timed out";
// The typedef for the Row type // The typedef for the Row type
class Row; class Row;
typedef std::shared_ptr<Row> SRow; typedef std::tr1::shared_ptr<Row> SRow;
typedef std::vector<std::string> ValueVector; typedef std::vector<std::string> ValueVector;
typedef std::shared_ptr<ValueVector> SValueVector; typedef std::tr1::shared_ptr<ValueVector> SValueVector;
typedef std::map<std::string, std::string> ValueMap; typedef std::map<std::string, std::string> ValueMap;
// A class that represents a CDC connection // A class that represents a CDC connection