// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once template std::shared_ptr PheonixSingleton(TArgs&&... args) { static std::weak_ptr instance_; static std::mutex lock_; std::lock_guard lock(lock_); if (auto instance = instance_.lock()) { return instance; } auto instance = std::make_shared(std::forward(args)...); instance_ = instance; return instance; }