THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr)
Client: C++
This closes #1328
diff --git a/tutorial/cpp/CppServer.cpp b/tutorial/cpp/CppServer.cpp
index eafffa9..80b100e 100644
--- a/tutorial/cpp/CppServer.cpp
+++ b/tutorial/cpp/CppServer.cpp
@@ -27,8 +27,7 @@
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TTransportUtils.h>
#include <thrift/TToString.h>
-
-#include <boost/make_shared.hpp>
+#include <thrift/stdcxx.h>
#include <iostream>
#include <stdexcept>
@@ -118,7 +117,7 @@
virtual ~CalculatorCloneFactory() {}
virtual CalculatorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo)
{
- boost::shared_ptr<TSocket> sock = boost::dynamic_pointer_cast<TSocket>(connInfo.transport);
+ stdcxx::shared_ptr<TSocket> sock = stdcxx::dynamic_pointer_cast<TSocket>(connInfo.transport);
cout << "Incoming connection\n";
cout << "\tSocketInfo: " << sock->getSocketInfo() << "\n";
cout << "\tPeerHost: " << sock->getPeerHost() << "\n";
@@ -133,18 +132,18 @@
int main() {
TThreadedServer server(
- boost::make_shared<CalculatorProcessorFactory>(boost::make_shared<CalculatorCloneFactory>()),
- boost::make_shared<TServerSocket>(9090), //port
- boost::make_shared<TBufferedTransportFactory>(),
- boost::make_shared<TBinaryProtocolFactory>());
+ stdcxx::make_shared<CalculatorProcessorFactory>(stdcxx::make_shared<CalculatorCloneFactory>()),
+ stdcxx::make_shared<TServerSocket>(9090), //port
+ stdcxx::make_shared<TBufferedTransportFactory>(),
+ stdcxx::make_shared<TBinaryProtocolFactory>());
/*
// if you don't need per-connection state, do the following instead
TThreadedServer server(
- boost::make_shared<CalculatorProcessor>(boost::make_shared<CalculatorHandler>()),
- boost::make_shared<TServerSocket>(9090), //port
- boost::make_shared<TBufferedTransportFactory>(),
- boost::make_shared<TBinaryProtocolFactory>());
+ stdcxx::make_shared<CalculatorProcessor>(stdcxx::make_shared<CalculatorHandler>()),
+ stdcxx::make_shared<TServerSocket>(9090), //port
+ stdcxx::make_shared<TBufferedTransportFactory>(),
+ stdcxx::make_shared<TBinaryProtocolFactory>());
*/
/**
@@ -152,25 +151,25 @@
// This server only allows one connection at a time, but spawns no threads
TSimpleServer server(
- boost::make_shared<CalculatorProcessor>(boost::make_shared<CalculatorHandler>()),
- boost::make_shared<TServerSocket>(9090),
- boost::make_shared<TBufferedTransportFactory>(),
- boost::make_shared<TBinaryProtocolFactory>());
+ stdcxx::make_shared<CalculatorProcessor>(stdcxx::make_shared<CalculatorHandler>()),
+ stdcxx::make_shared<TServerSocket>(9090),
+ stdcxx::make_shared<TBufferedTransportFactory>(),
+ stdcxx::make_shared<TBinaryProtocolFactory>());
const int workerCount = 4;
- boost::shared_ptr<ThreadManager> threadManager =
+ stdcxx::shared_ptr<ThreadManager> threadManager =
ThreadManager::newSimpleThreadManager(workerCount);
threadManager->threadFactory(
- boost::make_shared<PlatformThreadFactory>());
+ stdcxx::make_shared<PlatformThreadFactory>());
threadManager->start();
// This server allows "workerCount" connection at a time, and reuses threads
TThreadPoolServer server(
- boost::make_shared<CalculatorProcessorFactory>(boost::make_shared<CalculatorCloneFactory>()),
- boost::make_shared<TServerSocket>(9090),
- boost::make_shared<TBufferedTransportFactory>(),
- boost::make_shared<TBinaryProtocolFactory>(),
+ stdcxx::make_shared<CalculatorProcessorFactory>(stdcxx::make_shared<CalculatorCloneFactory>()),
+ stdcxx::make_shared<TServerSocket>(9090),
+ stdcxx::make_shared<TBufferedTransportFactory>(),
+ stdcxx::make_shared<TBinaryProtocolFactory>(),
threadManager);
*/