#pragma once #include #include "common.hpp" POLYBAR_NS namespace factory_util { struct null_deleter { template void operator()(T*) const {} }; struct fd_deleter { void operator()(int* fd) const { if (fd != nullptr && *fd > 0) { close(*fd); } } }; template unique_ptr unique(Deps&&... deps) { return make_unique(forward(deps)...); } template shared_ptr shared(Deps&&... deps) { return make_shared(forward(deps)...); } template shared_ptr singleton(Deps&&... deps) { static auto instance = make_shared(forward(deps)...); return instance; } } POLYBAR_NS_END