diff options
Diffstat (limited to 'service/uptr.h')
-rw-r--r-- | service/uptr.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/service/uptr.h b/service/uptr.h index 17eb28d..e73e098 100644 --- a/service/uptr.h +++ b/service/uptr.h @@ -1,24 +1,22 @@ #ifndef MIRRORSEARCH_UPTR_H #define MIRRORSEARCH_UPTR_H -#include <memory> #include <functional> +#include <memory> #include <stdexcept> namespace MirrorSearch { typedef std::function<void(const std::string &)> OnError; - std::string - failingFunction(void * const func); + std::string failingFunction(void * const func); - void - defaultErrorHandler(const std::string &); + void defaultErrorHandler(const std::string &); - template<typename O> using UPtr = std::unique_ptr<O, void(*)(O*)>; + template<typename O> using UPtr = std::unique_ptr<O, void (*)(O *)>; - template<typename R, typename ... P, typename ... A> + template<typename R, typename... P, typename... A> R * - make_unique(R * (*func)(P...), OnError onError, A ... p) + make_unique(R * (*func)(P...), OnError onError, A... p) { if (auto obj = func(p...)) { return obj; @@ -27,13 +25,12 @@ namespace MirrorSearch { throw std::runtime_error("Error handler did not throw"); } - template<typename R, typename ... P, typename ... A> + template<typename R, typename... P, typename... A> UPtr<R> - make_unique(R*(*get)(P...), void(*release)(R*), OnError onError, A ... p) + make_unique(R * (*get)(P...), void (*release)(R *), OnError onError, A... p) { - return std::unique_ptr<R, void(*)(R*)>(make_unique(get, onError, p...), release); + return std::unique_ptr<R, void (*)(R *)>(make_unique(get, onError, p...), release); } } #endif - |