THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr)
Client: C++

This closes #1328
diff --git a/test/cpp/src/StressTest.cpp b/test/cpp/src/StressTest.cpp
index 9371bce..5ff5e44 100644
--- a/test/cpp/src/StressTest.cpp
+++ b/test/cpp/src/StressTest.cpp
@@ -31,6 +31,7 @@
 #include <thrift/transport/TTransportUtils.h>
 #include <thrift/transport/TFileTransport.h>
 #include <thrift/TLogging.h>
+#include <thrift/stdcxx.h>
 
 #include "Service.h"
 #include <iostream>
@@ -107,8 +108,8 @@
 };
 class ClientThread : public Runnable {
 public:
-  ClientThread(boost::shared_ptr<TTransport> transport,
-               boost::shared_ptr<ServiceIf> client,
+  ClientThread(stdcxx::shared_ptr<TTransport> transport,
+               stdcxx::shared_ptr<ServiceIf> client,
                Monitor& monitor,
                size_t& workerCount,
                size_t loopCount,
@@ -224,8 +225,8 @@
     }
   }
 
-  boost::shared_ptr<TTransport> _transport;
-  boost::shared_ptr<ServiceIf> _client;
+  stdcxx::shared_ptr<TTransport> _transport;
+  stdcxx::shared_ptr<ServiceIf> _client;
   Monitor& _monitor;
   size_t& _workerCount;
   size_t _loopCount;
@@ -285,14 +286,14 @@
                             "server only.  Default is " << clientCount << endl
         << "\thelp           Prints this help text." << endl
         << "\tcall           Service method to call.  Default is " << callName << endl
-        << "\tloop           The number of remote thrift calls each client makes.  Default is " << loopCount << endl 
+        << "\tloop           The number of remote thrift calls each client makes.  Default is " << loopCount << endl
         << "\tport           The port the server and clients should bind to "
                             "for thrift network connections.  Default is " << port << endl
-        << "\tserver         Run the Thrift server in this process.  Default is " << runServer << endl 
+        << "\tserver         Run the Thrift server in this process.  Default is " << runServer << endl
         << "\tserver-type    Type of server, \"simple\" or \"thread-pool\".  Default is " << serverType << endl
         << "\tprotocol-type  Type of protocol, \"binary\", \"ascii\", or \"xml\".  Default is " << protocolType << endl
-        << "\tlog-request    Log all request to ./requestlog.tlog. Default is " << logRequests << endl 
-        << "\treplay-request Replay requests from log file (./requestlog.tlog) Default is " << replayRequests << endl 
+        << "\tlog-request    Log all request to ./requestlog.tlog. Default is " << logRequests << endl
+        << "\treplay-request Replay requests from log file (./requestlog.tlog) Default is " << replayRequests << endl
         << "\tworkers        Number of thread pools workers.  Only valid "
                             "for thread-pool server type.  Default is " << workerCount << endl
         << "\tclient-type    Type of client, \"regular\" or \"concurrent\".  Default is " << clientType << endl
@@ -390,24 +391,24 @@
     cerr << usage.str();
   }
 
-  boost::shared_ptr<PlatformThreadFactory> threadFactory
-      = boost::shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
+  stdcxx::shared_ptr<PlatformThreadFactory> threadFactory
+      = stdcxx::shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
 
   // Dispatcher
-  boost::shared_ptr<Server> serviceHandler(new Server());
+  stdcxx::shared_ptr<Server> serviceHandler(new Server());
 
   if (replayRequests) {
-    boost::shared_ptr<Server> serviceHandler(new Server());
-    boost::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
+    stdcxx::shared_ptr<Server> serviceHandler(new Server());
+    stdcxx::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
 
     // Transports
-    boost::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
+    stdcxx::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
     fileTransport->setChunkSize(2 * 1024 * 1024);
     fileTransport->setMaxEventSize(1024 * 16);
     fileTransport->seekToEnd();
 
     // Protocol Factory
-    boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+    stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
 
     TFileProcessor fileProcessor(serviceProcessor, protocolFactory, fileTransport);
 
@@ -417,28 +418,28 @@
 
   if (runServer) {
 
-    boost::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
+    stdcxx::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
 
     // Transport
-    boost::shared_ptr<TServerSocket> serverSocket(new TServerSocket(port));
+    stdcxx::shared_ptr<TServerSocket> serverSocket(new TServerSocket(port));
 
     // Transport Factory
-    boost::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
+    stdcxx::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
 
     // Protocol Factory
-    boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+    stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
 
     if (logRequests) {
       // initialize the log file
-      boost::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
+      stdcxx::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
       fileTransport->setChunkSize(2 * 1024 * 1024);
       fileTransport->setMaxEventSize(1024 * 16);
 
       transportFactory
-          = boost::shared_ptr<TTransportFactory>(new TPipedTransportFactory(fileTransport));
+          = stdcxx::shared_ptr<TTransportFactory>(new TPipedTransportFactory(fileTransport));
     }
 
-    boost::shared_ptr<TServer> server;
+    stdcxx::shared_ptr<TServer> server;
 
     if (serverType == "simple") {
 
@@ -452,7 +453,7 @@
 
     } else if (serverType == "thread-pool") {
 
-      boost::shared_ptr<ThreadManager> threadManager
+      stdcxx::shared_ptr<ThreadManager> threadManager
           = ThreadManager::newSimpleThreadManager(workerCount);
 
       threadManager->threadFactory(threadFactory);
@@ -464,9 +465,9 @@
                                          threadManager));
     }
 
-    boost::shared_ptr<TStartObserver> observer(new TStartObserver);
+    stdcxx::shared_ptr<TStartObserver> observer(new TStartObserver);
     server->setServerEventHandler(observer);
-    boost::shared_ptr<Thread> serverThread = threadFactory->newThread(server);
+    stdcxx::shared_ptr<Thread> serverThread = threadFactory->newThread(server);
 
     cerr << "Starting the server on port " << port << endl;
 
@@ -485,7 +486,7 @@
 
     size_t threadCount = 0;
 
-    set<boost::shared_ptr<Thread> > clientThreads;
+    set<stdcxx::shared_ptr<Thread> > clientThreads;
 
     if (callName == "echoVoid") {
       loopType = T_VOID;
@@ -504,28 +505,28 @@
     if(clientType == "regular") {
       for (size_t ix = 0; ix < clientCount; ix++) {
 
-        boost::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port));
-        boost::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
-        boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket));
-        boost::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
+        stdcxx::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port));
+        stdcxx::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
+        stdcxx::shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket));
+        stdcxx::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
 
-        clientThreads.insert(threadFactory->newThread(boost::shared_ptr<ClientThread>(
+        clientThreads.insert(threadFactory->newThread(stdcxx::shared_ptr<ClientThread>(
             new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType, OpenAndCloseTransportInThread))));
       }
     } else if(clientType == "concurrent") {
-      boost::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port));
-      boost::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
-      boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket));
-      //boost::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
-      boost::shared_ptr<ServiceConcurrentClient> serviceClient(new ServiceConcurrentClient(protocol));
+      stdcxx::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port));
+      stdcxx::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket, 2048));
+      stdcxx::shared_ptr<TProtocol> protocol(new TBinaryProtocol(bufferedSocket));
+      //stdcxx::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
+      stdcxx::shared_ptr<ServiceConcurrentClient> serviceClient(new ServiceConcurrentClient(protocol));
       socket->open();
       for (size_t ix = 0; ix < clientCount; ix++) {
-        clientThreads.insert(threadFactory->newThread(boost::shared_ptr<ClientThread>(
+        clientThreads.insert(threadFactory->newThread(stdcxx::shared_ptr<ClientThread>(
             new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType, DontOpenAndCloseTransportInThread))));
       }
     }
 
-    for (std::set<boost::shared_ptr<Thread> >::const_iterator thread = clientThreads.begin();
+    for (std::set<stdcxx::shared_ptr<Thread> >::const_iterator thread = clientThreads.begin();
          thread != clientThreads.end();
          thread++) {
       (*thread)->start();
@@ -558,12 +559,12 @@
     int64_t minTime = 9223372036854775807LL;
     int64_t maxTime = 0;
 
-    for (set<boost::shared_ptr<Thread> >::iterator ix = clientThreads.begin();
+    for (set<stdcxx::shared_ptr<Thread> >::iterator ix = clientThreads.begin();
          ix != clientThreads.end();
          ix++) {
 
-      boost::shared_ptr<ClientThread> client
-          = boost::dynamic_pointer_cast<ClientThread>((*ix)->runnable());
+      stdcxx::shared_ptr<ClientThread> client
+          = stdcxx::dynamic_pointer_cast<ClientThread>((*ix)->runnable());
 
       int64_t delta = client->_endTime - client->_startTime;
 
diff --git a/test/cpp/src/StressTestNonBlocking.cpp b/test/cpp/src/StressTestNonBlocking.cpp
index 1ebb9e0..e68988f 100644
--- a/test/cpp/src/StressTestNonBlocking.cpp
+++ b/test/cpp/src/StressTestNonBlocking.cpp
@@ -33,11 +33,10 @@
 #include <thrift/transport/TTransportUtils.h>
 #include <thrift/transport/TFileTransport.h>
 #include <thrift/TLogging.h>
+#include <thrift/stdcxx.h>
 
 #include "Service.h"
 
-#include <boost/shared_ptr.hpp>
-
 #include <iostream>
 #include <set>
 #include <stdexcept>
@@ -110,8 +109,8 @@
 
 class ClientThread : public Runnable {
 public:
-  ClientThread(boost::shared_ptr<TTransport> transport,
-               boost::shared_ptr<ServiceClient> client,
+  ClientThread(stdcxx::shared_ptr<TTransport> transport,
+               stdcxx::shared_ptr<ServiceClient> client,
                Monitor& monitor,
                size_t& workerCount,
                size_t loopCount,
@@ -222,8 +221,8 @@
     }
   }
 
-  boost::shared_ptr<TTransport> _transport;
-  boost::shared_ptr<ServiceClient> _client;
+  stdcxx::shared_ptr<TTransport> _transport;
+  stdcxx::shared_ptr<ServiceClient> _client;
   Monitor& _monitor;
   size_t& _workerCount;
   size_t _loopCount;
@@ -345,24 +344,24 @@
     cerr << usage.str();
   }
 
-  boost::shared_ptr<PlatformThreadFactory> threadFactory
-      = boost::shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
+  stdcxx::shared_ptr<PlatformThreadFactory> threadFactory
+      = stdcxx::shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
 
   // Dispatcher
-  boost::shared_ptr<Server> serviceHandler(new Server());
+  stdcxx::shared_ptr<Server> serviceHandler(new Server());
 
   if (replayRequests) {
-    boost::shared_ptr<Server> serviceHandler(new Server());
-    boost::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
+    stdcxx::shared_ptr<Server> serviceHandler(new Server());
+    stdcxx::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
 
     // Transports
-    boost::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
+    stdcxx::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
     fileTransport->setChunkSize(2 * 1024 * 1024);
     fileTransport->setMaxEventSize(1024 * 16);
     fileTransport->seekToEnd();
 
     // Protocol Factory
-    boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+    stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
 
     TFileProcessor fileProcessor(serviceProcessor, protocolFactory, fileTransport);
 
@@ -372,48 +371,50 @@
 
   if (runServer) {
 
-    boost::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
+    stdcxx::shared_ptr<ServiceProcessor> serviceProcessor(new ServiceProcessor(serviceHandler));
 
     // Protocol Factory
-    boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+    stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
 
     // Transport Factory
-    boost::shared_ptr<TTransportFactory> transportFactory;
+    stdcxx::shared_ptr<TTransportFactory> transportFactory;
 
     if (logRequests) {
       // initialize the log file
-      boost::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
+      stdcxx::shared_ptr<TFileTransport> fileTransport(new TFileTransport(requestLogPath));
       fileTransport->setChunkSize(2 * 1024 * 1024);
       fileTransport->setMaxEventSize(1024 * 16);
 
       transportFactory
-          = boost::shared_ptr<TTransportFactory>(new TPipedTransportFactory(fileTransport));
+          = stdcxx::shared_ptr<TTransportFactory>(new TPipedTransportFactory(fileTransport));
     }
 
-    boost::shared_ptr<Thread> serverThread;
-    boost::shared_ptr<Thread> serverThread2;
-    boost::shared_ptr<transport::TNonblockingServerSocket> nbSocket1, nbSocket2;
+    stdcxx::shared_ptr<Thread> serverThread;
+    stdcxx::shared_ptr<Thread> serverThread2;
+    stdcxx::shared_ptr<transport::TNonblockingServerSocket> nbSocket1;
+    stdcxx::shared_ptr<transport::TNonblockingServerSocket> nbSocket2;
 
     if (serverType == "simple") {
+
       nbSocket1.reset(new transport::TNonblockingServerSocket(port));
-      serverThread = threadFactory->newThread(boost::shared_ptr<TServer>(
+      serverThread = threadFactory->newThread(stdcxx::shared_ptr<TServer>(
           new TNonblockingServer(serviceProcessor, protocolFactory, nbSocket1)));
       nbSocket2.reset(new transport::TNonblockingServerSocket(port + 1));
-      serverThread2 = threadFactory->newThread(boost::shared_ptr<TServer>(
+      serverThread2 = threadFactory->newThread(stdcxx::shared_ptr<TServer>(
           new TNonblockingServer(serviceProcessor, protocolFactory, nbSocket2)));
 
     } else if (serverType == "thread-pool") {
 
-      boost::shared_ptr<ThreadManager> threadManager
+      stdcxx::shared_ptr<ThreadManager> threadManager
           = ThreadManager::newSimpleThreadManager(workerCount);
 
       threadManager->threadFactory(threadFactory);
       threadManager->start();
       nbSocket1.reset(new transport::TNonblockingServerSocket(port));
-      serverThread = threadFactory->newThread(boost::shared_ptr<TServer>(
+      serverThread = threadFactory->newThread(stdcxx::shared_ptr<TServer>(
           new TNonblockingServer(serviceProcessor, protocolFactory, nbSocket1, threadManager)));
       nbSocket2.reset(new transport::TNonblockingServerSocket(port + 1));
-      serverThread2 = threadFactory->newThread(boost::shared_ptr<TServer>(
+      serverThread2 = threadFactory->newThread(stdcxx::shared_ptr<TServer>(
           new TNonblockingServer(serviceProcessor, protocolFactory, nbSocket2, threadManager)));
     }
 
@@ -436,7 +437,7 @@
 
     size_t threadCount = 0;
 
-    set<boost::shared_ptr<Thread> > clientThreads;
+    set<stdcxx::shared_ptr<Thread> > clientThreads;
 
     if (callName == "echoVoid") {
       loopType = T_VOID;
@@ -454,16 +455,16 @@
 
     for (uint32_t ix = 0; ix < clientCount; ix++) {
 
-      boost::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port + (ix % 2)));
-      boost::shared_ptr<TFramedTransport> framedSocket(new TFramedTransport(socket));
-      boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(framedSocket));
-      boost::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
+      stdcxx::shared_ptr<TSocket> socket(new TSocket("127.0.0.1", port + (ix % 2)));
+      stdcxx::shared_ptr<TFramedTransport> framedSocket(new TFramedTransport(socket));
+      stdcxx::shared_ptr<TProtocol> protocol(new TBinaryProtocol(framedSocket));
+      stdcxx::shared_ptr<ServiceClient> serviceClient(new ServiceClient(protocol));
 
-      clientThreads.insert(threadFactory->newThread(boost::shared_ptr<ClientThread>(
+      clientThreads.insert(threadFactory->newThread(stdcxx::shared_ptr<ClientThread>(
           new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType))));
     }
 
-    for (std::set<boost::shared_ptr<Thread> >::const_iterator thread = clientThreads.begin();
+    for (std::set<stdcxx::shared_ptr<Thread> >::const_iterator thread = clientThreads.begin();
          thread != clientThreads.end();
          thread++) {
       (*thread)->start();
@@ -496,12 +497,12 @@
     int64_t minTime = 9223372036854775807LL;
     int64_t maxTime = 0;
 
-    for (set<boost::shared_ptr<Thread> >::iterator ix = clientThreads.begin();
+    for (set<stdcxx::shared_ptr<Thread> >::iterator ix = clientThreads.begin();
          ix != clientThreads.end();
          ix++) {
 
-      boost::shared_ptr<ClientThread> client
-          = boost::dynamic_pointer_cast<ClientThread>((*ix)->runnable());
+      stdcxx::shared_ptr<ClientThread> client
+          = stdcxx::dynamic_pointer_cast<ClientThread>((*ix)->runnable());
 
       int64_t delta = client->_endTime - client->_startTime;
 
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 6ecf540..6b2e731 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -40,10 +40,9 @@
 #include <inttypes.h>
 #endif
 
-#include <boost/shared_ptr.hpp>
 #include <boost/program_options.hpp>
 #include <boost/filesystem.hpp>
-#include <thrift/cxxfunctional.h>
+#include <thrift/stdcxx.h>
 #if _WIN32
 #include <thrift/windows/TWinsockSingleton.h>
 #endif
@@ -52,10 +51,10 @@
 
 using namespace std;
 using namespace apache::thrift;
+using namespace apache::thrift::async;
 using namespace apache::thrift::protocol;
 using namespace apache::thrift::transport;
 using namespace thrift::test;
-using namespace apache::thrift::async;
 
 // Current time, microseconds since the epoch
 uint64_t now() {
@@ -94,10 +93,10 @@
     for (int testNr = 0; testNr < 10; ++testNr) {
       std::ostringstream os;
       os << "test" << testNr;
-      client->testString(tcxx::bind(testString_clientReturn,
+      client->testString(stdcxx::bind(testString_clientReturn,
                                     base,
                                     testNr,
-                                    tcxx::placeholders::_1),
+                                    stdcxx::placeholders::_1),
                        os.str());
     }
   } catch (TException& exn) {
@@ -229,17 +228,17 @@
   }
 
   // THRIFT-4164: The factory MUST outlive any sockets it creates for correct behavior!
-  boost::shared_ptr<TSSLSocketFactory> factory;
-  boost::shared_ptr<TSocket> socket;
-  boost::shared_ptr<TTransport> transport;
-  boost::shared_ptr<TProtocol> protocol;
+  stdcxx::shared_ptr<TSSLSocketFactory> factory;
+  stdcxx::shared_ptr<TSocket> socket;
+  stdcxx::shared_ptr<TTransport> transport;
+  stdcxx::shared_ptr<TProtocol> protocol;
 
   if (ssl) {
     cout << "Client Certificate File: " << certPath << endl;
     cout << "Client Key         File: " << keyPath << endl;
     cout << "CA                 File: " << caPath << endl;
 
-    factory = boost::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory());
+    factory = stdcxx::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory());
     factory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
     factory->loadTrustedCertificates(caPath.c_str());
     factory->loadCertificate(certPath.c_str());
@@ -251,38 +250,38 @@
       if (abstract_namespace) {
         std::string abstract_socket("\0", 1);
         abstract_socket += domain_socket;
-        socket = boost::shared_ptr<TSocket>(new TSocket(abstract_socket));
+        socket = stdcxx::shared_ptr<TSocket>(new TSocket(abstract_socket));
       } else {
-        socket = boost::shared_ptr<TSocket>(new TSocket(domain_socket));
+        socket = stdcxx::shared_ptr<TSocket>(new TSocket(domain_socket));
       }
       port = 0;
     } else {
-      socket = boost::shared_ptr<TSocket>(new TSocket(host, port));
+      socket = stdcxx::shared_ptr<TSocket>(new TSocket(host, port));
     }
   }
 
   if (transport_type.compare("http") == 0) {
-    boost::shared_ptr<TTransport> httpSocket(new THttpClient(socket, host, "/service"));
+    stdcxx::shared_ptr<TTransport> httpSocket(new THttpClient(socket, host, "/service"));
     transport = httpSocket;
   } else if (transport_type.compare("framed") == 0) {
-    boost::shared_ptr<TFramedTransport> framedSocket(new TFramedTransport(socket));
+    stdcxx::shared_ptr<TFramedTransport> framedSocket(new TFramedTransport(socket));
     transport = framedSocket;
   } else {
-    boost::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket));
+    stdcxx::shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket));
     transport = bufferedSocket;
   }
 
   if (protocol_type.compare("json") == 0) {
-    boost::shared_ptr<TProtocol> jsonProtocol(new TJSONProtocol(transport));
+    stdcxx::shared_ptr<TProtocol> jsonProtocol(new TJSONProtocol(transport));
     protocol = jsonProtocol;
   } else if (protocol_type.compare("compact") == 0) {
-    boost::shared_ptr<TProtocol> compactProtocol(new TCompactProtocol(transport));
+    stdcxx::shared_ptr<TProtocol> compactProtocol(new TCompactProtocol(transport));
     protocol = compactProtocol;
   } else if (protocol_type == "header") {
-    boost::shared_ptr<TProtocol> headerProtocol(new THeaderProtocol(transport));
+    stdcxx::shared_ptr<TProtocol> headerProtocol(new THeaderProtocol(transport));
     protocol = headerProtocol;
   } else {
-    boost::shared_ptr<TBinaryProtocol> binaryProtocol(new TBinaryProtocol(transport));
+    stdcxx::shared_ptr<TBinaryProtocol> binaryProtocol(new TBinaryProtocol(transport));
     protocol = binaryProtocol;
   }
 
@@ -305,14 +304,14 @@
     cout << "Libevent Features: 0x" << hex << event_base_get_features(base) << endl;
 #endif
 
-    boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+    stdcxx::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
 
-    boost::shared_ptr<TAsyncChannel> channel(
+    stdcxx::shared_ptr<TAsyncChannel> channel(
         new TEvhttpClientChannel(host.c_str(), "/", host.c_str(), port, base));
     ThriftTestCobClient* client = new ThriftTestCobClient(channel, protocolFactory.get());
-    client->testVoid(tcxx::bind(testVoid_clientReturn,
+    client->testVoid(stdcxx::bind(testVoid_clientReturn,
                                 base,
-                                tcxx::placeholders::_1));
+                                stdcxx::placeholders::_1));
 
     event_base_loop(base, 0);
     return 0;
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 2b58f8a..37d0eb6 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -52,7 +52,7 @@
 
 #include <boost/program_options.hpp>
 #include <boost/filesystem.hpp>
-#include <thrift/cxxfunctional.h>
+#include <thrift/stdcxx.h>
 
 #include <signal.h>
 #if _WIN32
@@ -62,11 +62,11 @@
 using namespace std;
 
 using namespace apache::thrift;
+using namespace apache::thrift::async;
 using namespace apache::thrift::concurrency;
 using namespace apache::thrift::protocol;
 using namespace apache::thrift::transport;
 using namespace apache::thrift::server;
-using namespace apache::thrift::async;
 
 using namespace thrift::test;
 
@@ -371,66 +371,66 @@
 
 class TestHandlerAsync : public ThriftTestCobSvIf {
 public:
-  TestHandlerAsync(boost::shared_ptr<TestHandler>& handler) : _delegate(handler) {}
+  TestHandlerAsync(stdcxx::shared_ptr<TestHandler>& handler) : _delegate(handler) {}
   virtual ~TestHandlerAsync() {}
 
-  virtual void testVoid(tcxx::function<void()> cob) {
+  virtual void testVoid(stdcxx::function<void()> cob) {
     _delegate->testVoid();
     cob();
   }
 
-  virtual void testString(tcxx::function<void(std::string const& _return)> cob,
+  virtual void testString(stdcxx::function<void(std::string const& _return)> cob,
                           const std::string& thing) {
     std::string res;
     _delegate->testString(res, thing);
     cob(res);
   }
 
-  virtual void testBool(tcxx::function<void(bool const& _return)> cob, const bool thing) {
+  virtual void testBool(stdcxx::function<void(bool const& _return)> cob, const bool thing) {
     bool res = _delegate->testBool(thing);
     cob(res);
   }
 
-  virtual void testByte(tcxx::function<void(int8_t const& _return)> cob, const int8_t thing) {
+  virtual void testByte(stdcxx::function<void(int8_t const& _return)> cob, const int8_t thing) {
     int8_t res = _delegate->testByte(thing);
     cob(res);
   }
 
-  virtual void testI32(tcxx::function<void(int32_t const& _return)> cob, const int32_t thing) {
+  virtual void testI32(stdcxx::function<void(int32_t const& _return)> cob, const int32_t thing) {
     int32_t res = _delegate->testI32(thing);
     cob(res);
   }
 
-  virtual void testI64(tcxx::function<void(int64_t const& _return)> cob, const int64_t thing) {
+  virtual void testI64(stdcxx::function<void(int64_t const& _return)> cob, const int64_t thing) {
     int64_t res = _delegate->testI64(thing);
     cob(res);
   }
 
-  virtual void testDouble(tcxx::function<void(double const& _return)> cob, const double thing) {
+  virtual void testDouble(stdcxx::function<void(double const& _return)> cob, const double thing) {
     double res = _delegate->testDouble(thing);
     cob(res);
   }
 
-  virtual void testBinary(tcxx::function<void(std::string const& _return)> cob,
+  virtual void testBinary(stdcxx::function<void(std::string const& _return)> cob,
                           const std::string& thing) {
     std::string res;
     _delegate->testBinary(res, thing);
     cob(res);
   }
 
-  virtual void testStruct(tcxx::function<void(Xtruct const& _return)> cob, const Xtruct& thing) {
+  virtual void testStruct(stdcxx::function<void(Xtruct const& _return)> cob, const Xtruct& thing) {
     Xtruct res;
     _delegate->testStruct(res, thing);
     cob(res);
   }
 
-  virtual void testNest(tcxx::function<void(Xtruct2 const& _return)> cob, const Xtruct2& thing) {
+  virtual void testNest(stdcxx::function<void(Xtruct2 const& _return)> cob, const Xtruct2& thing) {
     Xtruct2 res;
     _delegate->testNest(res, thing);
     cob(res);
   }
 
-  virtual void testMap(tcxx::function<void(std::map<int32_t, int32_t> const& _return)> cob,
+  virtual void testMap(stdcxx::function<void(std::map<int32_t, int32_t> const& _return)> cob,
                        const std::map<int32_t, int32_t>& thing) {
     std::map<int32_t, int32_t> res;
     _delegate->testMap(res, thing);
@@ -438,40 +438,40 @@
   }
 
   virtual void testStringMap(
-      tcxx::function<void(std::map<std::string, std::string> const& _return)> cob,
+      stdcxx::function<void(std::map<std::string, std::string> const& _return)> cob,
       const std::map<std::string, std::string>& thing) {
     std::map<std::string, std::string> res;
     _delegate->testStringMap(res, thing);
     cob(res);
   }
 
-  virtual void testSet(tcxx::function<void(std::set<int32_t> const& _return)> cob,
+  virtual void testSet(stdcxx::function<void(std::set<int32_t> const& _return)> cob,
                        const std::set<int32_t>& thing) {
     std::set<int32_t> res;
     _delegate->testSet(res, thing);
     cob(res);
   }
 
-  virtual void testList(tcxx::function<void(std::vector<int32_t> const& _return)> cob,
+  virtual void testList(stdcxx::function<void(std::vector<int32_t> const& _return)> cob,
                         const std::vector<int32_t>& thing) {
     std::vector<int32_t> res;
     _delegate->testList(res, thing);
     cob(res);
   }
 
-  virtual void testEnum(tcxx::function<void(Numberz::type const& _return)> cob,
+  virtual void testEnum(stdcxx::function<void(Numberz::type const& _return)> cob,
                         const Numberz::type thing) {
     Numberz::type res = _delegate->testEnum(thing);
     cob(res);
   }
 
-  virtual void testTypedef(tcxx::function<void(UserId const& _return)> cob, const UserId thing) {
+  virtual void testTypedef(stdcxx::function<void(UserId const& _return)> cob, const UserId thing) {
     UserId res = _delegate->testTypedef(thing);
     cob(res);
   }
 
   virtual void testMapMap(
-      tcxx::function<void(std::map<int32_t, std::map<int32_t, int32_t> > const& _return)> cob,
+      stdcxx::function<void(std::map<int32_t, std::map<int32_t, int32_t> > const& _return)> cob,
       const int32_t hello) {
     std::map<int32_t, std::map<int32_t, int32_t> > res;
     _delegate->testMapMap(res, hello);
@@ -479,14 +479,14 @@
   }
 
   virtual void testInsanity(
-      tcxx::function<void(std::map<UserId, std::map<Numberz::type, Insanity> > const& _return)> cob,
+      stdcxx::function<void(std::map<UserId, std::map<Numberz::type, Insanity> > const& _return)> cob,
       const Insanity& argument) {
     std::map<UserId, std::map<Numberz::type, Insanity> > res;
     _delegate->testInsanity(res, argument);
     cob(res);
   }
 
-  virtual void testMulti(tcxx::function<void(Xtruct const& _return)> cob,
+  virtual void testMulti(stdcxx::function<void(Xtruct const& _return)> cob,
                          const int8_t arg0,
                          const int32_t arg1,
                          const int64_t arg2,
@@ -499,8 +499,8 @@
   }
 
   virtual void testException(
-      tcxx::function<void()> cob,
-      tcxx::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob,
+      stdcxx::function<void()> cob,
+      stdcxx::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob,
       const std::string& arg) {
     try {
       _delegate->testException(arg);
@@ -512,8 +512,8 @@
   }
 
   virtual void testMultiException(
-      tcxx::function<void(Xtruct const& _return)> cob,
-      tcxx::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob,
+      stdcxx::function<void(Xtruct const& _return)> cob,
+      stdcxx::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob,
       const std::string& arg0,
       const std::string& arg1) {
     Xtruct res;
@@ -526,13 +526,13 @@
     cob(res);
   }
 
-  virtual void testOneway(tcxx::function<void()> cob, const int32_t secondsToSleep) {
+  virtual void testOneway(stdcxx::function<void()> cob, const int32_t secondsToSleep) {
     _delegate->testOneway(secondsToSleep);
     cob();
   }
 
 protected:
-  boost::shared_ptr<TestHandler> _delegate;
+  stdcxx::shared_ptr<TestHandler> _delegate;
 };
 
 namespace po = boost::program_options;
@@ -626,9 +626,9 @@
   }
 
   // Dispatcher
-  boost::shared_ptr<TProtocolFactory> protocolFactory;
+  stdcxx::shared_ptr<TProtocolFactory> protocolFactory;
   if (protocol_type == "json") {
-    boost::shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
+    stdcxx::shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
     protocolFactory = jsonProtocolFactory;
   } else if (protocol_type == "compact") {
     TCompactProtocolFactoryT<TBufferBase> *compactProtocolFactory = new TCompactProtocolFactoryT<TBufferBase>();
@@ -636,7 +636,7 @@
     compactProtocolFactory->setStringSizeLimit(string_limit);
     protocolFactory.reset(compactProtocolFactory);
   } else if (protocol_type == "header") {
-    boost::shared_ptr<TProtocolFactory> headerProtocolFactory(new THeaderProtocolFactory());
+    stdcxx::shared_ptr<TProtocolFactory> headerProtocolFactory(new THeaderProtocolFactory());
     protocolFactory = headerProtocolFactory;
   } else {
     TBinaryProtocolFactoryT<TBufferBase>* binaryProtocolFactory = new TBinaryProtocolFactoryT<TBufferBase>();
@@ -646,51 +646,51 @@
   }
 
   // Processor
-  boost::shared_ptr<TestHandler> testHandler(new TestHandler());
-  boost::shared_ptr<ThriftTestProcessor> testProcessor(new ThriftTestProcessor(testHandler));
+  stdcxx::shared_ptr<TestHandler> testHandler(new TestHandler());
+  stdcxx::shared_ptr<ThriftTestProcessor> testProcessor(new ThriftTestProcessor(testHandler));
 
   if (vm.count("processor-events")) {
     testProcessor->setEventHandler(
-        boost::shared_ptr<TProcessorEventHandler>(new TestProcessorEventHandler()));
+        stdcxx::shared_ptr<TProcessorEventHandler>(new TestProcessorEventHandler()));
   }
 
   // Transport
-  boost::shared_ptr<TSSLSocketFactory> sslSocketFactory;
-  boost::shared_ptr<TServerSocket> serverSocket;
+  stdcxx::shared_ptr<TSSLSocketFactory> sslSocketFactory;
+  stdcxx::shared_ptr<TServerSocket> serverSocket;
 
   if (ssl) {
-    sslSocketFactory = boost::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory());
+    sslSocketFactory = stdcxx::shared_ptr<TSSLSocketFactory>(new TSSLSocketFactory());
     sslSocketFactory->loadCertificate(certPath.c_str());
     sslSocketFactory->loadPrivateKey(keyPath.c_str());
     sslSocketFactory->ciphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
-    serverSocket = boost::shared_ptr<TServerSocket>(new TSSLServerSocket(port, sslSocketFactory));
+    serverSocket = stdcxx::shared_ptr<TServerSocket>(new TSSLServerSocket(port, sslSocketFactory));
   } else {
     if (domain_socket != "") {
       if (abstract_namespace) {
         std::string abstract_socket("\0", 1);
         abstract_socket += domain_socket;
-        serverSocket = boost::shared_ptr<TServerSocket>(new TServerSocket(abstract_socket));
+        serverSocket = stdcxx::shared_ptr<TServerSocket>(new TServerSocket(abstract_socket));
       } else {
         unlink(domain_socket.c_str());
-        serverSocket = boost::shared_ptr<TServerSocket>(new TServerSocket(domain_socket));
+        serverSocket = stdcxx::shared_ptr<TServerSocket>(new TServerSocket(domain_socket));
       }
       port = 0;
     } else {
-      serverSocket = boost::shared_ptr<TServerSocket>(new TServerSocket(port));
+      serverSocket = stdcxx::shared_ptr<TServerSocket>(new TServerSocket(port));
     }
   }
 
   // Factory
-  boost::shared_ptr<TTransportFactory> transportFactory;
+  stdcxx::shared_ptr<TTransportFactory> transportFactory;
 
   if (transport_type == "http" && server_type != "nonblocking") {
-    boost::shared_ptr<TTransportFactory> httpTransportFactory(new THttpServerTransportFactory());
+    stdcxx::shared_ptr<TTransportFactory> httpTransportFactory(new THttpServerTransportFactory());
     transportFactory = httpTransportFactory;
   } else if (transport_type == "framed") {
-    boost::shared_ptr<TTransportFactory> framedTransportFactory(new TFramedTransportFactory());
+    stdcxx::shared_ptr<TTransportFactory> framedTransportFactory(new TFramedTransportFactory());
     transportFactory = framedTransportFactory;
   } else {
-    boost::shared_ptr<TTransportFactory> bufferedTransportFactory(new TBufferedTransportFactory());
+    stdcxx::shared_ptr<TTransportFactory> bufferedTransportFactory(new TBufferedTransportFactory());
     transportFactory = bufferedTransportFactory;
   }
 
@@ -707,16 +707,16 @@
   cout << endl;
 
   // Server
-  boost::shared_ptr<apache::thrift::server::TServer> server;
+  stdcxx::shared_ptr<apache::thrift::server::TServer> server;
 
   if (server_type == "simple") {
     server.reset(new TSimpleServer(testProcessor, serverSocket, transportFactory, protocolFactory));
   } else if (server_type == "thread-pool") {
 
-    boost::shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(workers);
+    stdcxx::shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(workers);
 
-    boost::shared_ptr<PlatformThreadFactory> threadFactory
-        = boost::shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
+    stdcxx::shared_ptr<PlatformThreadFactory> threadFactory
+        = stdcxx::shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
 
     threadManager->threadFactory(threadFactory);
 
@@ -733,10 +733,10 @@
         new TThreadedServer(testProcessor, serverSocket, transportFactory, protocolFactory));
   } else if (server_type == "nonblocking") {
     if (transport_type == "http") {
-      boost::shared_ptr<TestHandlerAsync> testHandlerAsync(new TestHandlerAsync(testHandler));
-      boost::shared_ptr<TAsyncProcessor> testProcessorAsync(
+      stdcxx::shared_ptr<TestHandlerAsync> testHandlerAsync(new TestHandlerAsync(testHandler));
+      stdcxx::shared_ptr<TAsyncProcessor> testProcessorAsync(
           new ThriftTestAsyncProcessor(testHandlerAsync));
-      boost::shared_ptr<TAsyncBufferProcessor> testBufferProcessor(
+      stdcxx::shared_ptr<TAsyncBufferProcessor> testBufferProcessor(
           new TAsyncProtocolProcessor(testProcessorAsync, protocolFactory));
 
       // not loading nonblockingServer into "server" because
@@ -745,7 +745,7 @@
       TEvhttpServer nonblockingServer(testBufferProcessor, port);
       nonblockingServer.serve();
     } else {
-      boost::shared_ptr<transport::TNonblockingServerSocket> nbSocket;
+      stdcxx::shared_ptr<transport::TNonblockingServerSocket> nbSocket;
       nbSocket.reset(new transport::TNonblockingServerSocket(port));
       server.reset(new TNonblockingServer(testProcessor, protocolFactory, nbSocket));
     }
@@ -755,12 +755,12 @@
     if (protocol_type == "header") {
       // Tell the server to use the same protocol for input / output
       // if using header
-      server->setOutputProtocolFactory(boost::shared_ptr<TProtocolFactory>());
+      server->setOutputProtocolFactory(stdcxx::shared_ptr<TProtocolFactory>());
     }
     apache::thrift::concurrency::PlatformThreadFactory factory;
     factory.setDetached(false);
-    boost::shared_ptr<apache::thrift::concurrency::Runnable> serverThreadRunner(server);
-    boost::shared_ptr<apache::thrift::concurrency::Thread> thread
+    stdcxx::shared_ptr<apache::thrift::concurrency::Runnable> serverThreadRunner(server);
+    stdcxx::shared_ptr<apache::thrift::concurrency::Thread> thread
         = factory.newThread(serverThreadRunner);
     thread->start();