The long road to correctness.

This commit is contained in:
ThePhD 2016-06-18 03:56:44 -04:00
parent f45ecdcff4
commit 48ba47b059

View File

@ -76,15 +76,14 @@ struct constructor_wrapper {
}; };
template <typename... Functions> template <typename... Functions>
constructor_wrapper<Functions...> initializers(Functions&&... functions) { inline auto initializers(Functions&&... functions) {
return constructor_wrapper<Functions...>(std::forward<Functions>(functions)...); return constructor_wrapper<std::decay_t<Functions>...>(std::forward<Functions>(functions)...);
} }
template <typename Function> template <typename Function>
struct destructor_wrapper { struct destructor_wrapper {
Function fx; Function fx;
template <typename... Args> destructor_wrapper(Function f): fx(std::move(f)) {}
destructor_wrapper(Args&&... args) : fx(std::forward<Args>(args)...) {}
}; };
template <> template <>
@ -93,7 +92,7 @@ struct destructor_wrapper<void> {};
const destructor_wrapper<void> default_destructor{}; const destructor_wrapper<void> default_destructor{};
template <typename Fx> template <typename Fx>
inline destructor_wrapper<Fx> destructor(Fx&& fx) { inline auto destructor(Fx&& fx) {
return destructor_wrapper<std::decay_t<Fx>>(std::forward<Fx>(fx)); return destructor_wrapper<std::decay_t<Fx>>(std::forward<Fx>(fx));
} }