#include <folly/portability/Sockets.h>
#include <boost/scoped_array.hpp>
+#include <memory>
enum StateEnum {
STATE_WAITING,
std::shared_ptr<BlockingSocket> accept(int timeout=50) {
int fd = acceptFD(timeout);
- return std::shared_ptr<BlockingSocket>(new BlockingSocket(fd));
+ return std::make_shared<BlockingSocket>(fd);
}
std::shared_ptr<folly::AsyncSocket> acceptAsync(folly::EventBase* evb,
// @author: Xin Liu <xliux@fb.com>
#include <map>
+#include <memory>
#include <random>
#include <set>
#include <thread>
static ConcurrentAccessData *mayInitTestData(int size) {
auto it = g_data.find(size);
if (it == g_data.end()) {
- auto ptr = std::shared_ptr<ConcurrentAccessData>(
- new ConcurrentAccessData(size));
+ auto ptr = std::make_shared<ConcurrentAccessData>(size);
g_data[size] = ptr;
return ptr.get();
}