2016-11-20 17:04:31 -05:00
|
|
|
#pragma once
|
|
|
|
|
2016-12-03 10:44:08 -05:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2016-11-20 17:04:31 -05:00
|
|
|
#include "common.hpp"
|
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
namespace factory_util {
|
2016-12-19 23:05:43 -05:00
|
|
|
namespace detail {
|
|
|
|
struct null_deleter {
|
|
|
|
template <typename T>
|
|
|
|
void operator()(T*) const {}
|
|
|
|
};
|
2021-09-21 15:15:49 -04:00
|
|
|
} // namespace detail
|
2016-12-19 23:05:43 -05:00
|
|
|
|
|
|
|
extern detail::null_deleter null_deleter;
|
2016-12-05 14:41:00 -05:00
|
|
|
|
|
|
|
template <class T, class... Deps>
|
|
|
|
shared_ptr<T> singleton(Deps&&... deps) {
|
2016-12-13 08:26:09 -05:00
|
|
|
static shared_ptr<T> instance{make_shared<T>(forward<Deps>(deps)...)};
|
2016-11-20 17:04:31 -05:00
|
|
|
return instance;
|
|
|
|
}
|
2021-09-21 15:15:49 -04:00
|
|
|
} // namespace factory_util
|
2016-11-20 17:04:31 -05:00
|
|
|
|
|
|
|
POLYBAR_NS_END
|