diff --git a/src/mock/ray/core_worker/memory_store.h b/src/mock/ray/core_worker/memory_store.h index 578f2fcfacb93..33753926ed183 100644 --- a/src/mock/ray/core_worker/memory_store.h +++ b/src/mock/ray/core_worker/memory_store.h @@ -25,16 +25,20 @@ class DefaultCoreWorkerMemoryStoreWithThread : public CoreWorkerMemoryStore { std::unique_ptr io_context = std::make_unique( "DefaultCoreWorkerMemoryStoreWithThread"); - return std::make_unique( - std::move(io_context)); + // C++ limitation: std::make_unique cannot be used because std::unique_ptr cannot + // invoke private constructors. + return std::unique_ptr( + new DefaultCoreWorkerMemoryStoreWithThread(std::move(io_context))); } static std::shared_ptr CreateShared() { std::unique_ptr io_context = std::make_unique( "DefaultCoreWorkerMemoryStoreWithThread"); - return std::make_shared( - std::move(io_context)); + // C++ limitation: std::make_shared cannot be used because std::shared_ptr cannot + // invoke private constructors. + return std::shared_ptr( + new DefaultCoreWorkerMemoryStoreWithThread(std::move(io_context))); } ~DefaultCoreWorkerMemoryStoreWithThread() { io_context_->Stop(); }