#pragma once #include #include #include NAMESPACE_LIBREMIDI { template struct deleter { template void operator()(U* x) noexcept(noexcept(func(x))) { func(x); } }; template using unique_handle = std::unique_ptr>; template std::shared_ptr instance() { static std::mutex mut; static std::weak_ptr cache; std::lock_guard _{mut}; if (auto ptr = cache.lock()) { return ptr; } else { auto shared = std::make_shared(); cache = shared; return shared; } } }