mirror of
https://github.com/polybar/polybar.git
synced 2024-11-11 13:50:56 -05:00
25 lines
536 B
C++
25 lines
536 B
C++
#pragma once
|
|
|
|
#include "common.hpp"
|
|
|
|
POLYBAR_NS
|
|
|
|
namespace factory_util {
|
|
struct null_deleter {
|
|
template <typename T>
|
|
void operator()(T*) const {}
|
|
};
|
|
|
|
template <class InstanceType, class... Deps>
|
|
unique_ptr<InstanceType> generic_instance(Deps... deps) {
|
|
return make_unique<InstanceType>(deps...);
|
|
}
|
|
|
|
template <class InstanceType, class... Deps>
|
|
shared_ptr<InstanceType> generic_singleton(Deps... deps) {
|
|
static auto instance = make_shared<InstanceType>(deps...);
|
|
return instance;
|
|
}
|
|
}
|
|
|
|
POLYBAR_NS_END
|