使用命名空間shared_ptr:spa
using boost::shared_ptr;server
調用 shared_ptr 的代碼:命名空間
shared_ptr<XXXXServiceHandler> handler(new XXXXServiceHandler(data));sso
shared_ptr<TProcessor> processor(new FrontServiceProcessor(handler));命名
shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));vi
shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());process
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());handler
修改:co
boost::shared_ptr<XXXXServiceHandler> handler(new XXXXServiceHandler(data));boost
boost::shared_ptr<TProcessor> processor(new FrontServiceProcessor(handler));
boost::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
boost::shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
boost::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());