1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-03 04:33:30 -05:00
polybar/include/utils/factory.hpp
patrick96 0d1db206c6 Remove factory_util unique and shared
Equivalent to std::make_unique and std::make_shared
2021-09-21 21:43:27 +02:00

26 lines
508 B
C++

#pragma once
#include <unistd.h>
#include "common.hpp"
POLYBAR_NS
namespace factory_util {
namespace detail {
struct null_deleter {
template <typename T>
void operator()(T*) const {}
};
} // namespace detail
extern detail::null_deleter null_deleter;
template <class T, class... Deps>
shared_ptr<T> singleton(Deps&&... deps) {
static shared_ptr<T> instance{make_shared<T>(forward<Deps>(deps)...)};
return instance;
}
} // namespace factory_util
POLYBAR_NS_END