polybar-dwm/include/utils/factory.hpp

18 lines
319 B
C++
Raw Normal View History

2016-11-20 22:04:31 +00:00
#pragma once
2016-12-03 15:44:08 +00:00
#include <unistd.h>
2016-11-20 22:04:31 +00:00
#include "common.hpp"
POLYBAR_NS
namespace factory_util {
template <class T, class... Deps>
shared_ptr<T> singleton(Deps&&... deps) {
static shared_ptr<T> instance{make_shared<T>(forward<Deps>(deps)...)};
2016-11-20 22:04:31 +00:00
return instance;
}
2022-03-06 16:44:48 +00:00
} // namespace factory_util
2016-11-20 22:04:31 +00:00
POLYBAR_NS_END