mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
The long road to correctness.
This commit is contained in:
parent
f45ecdcff4
commit
48ba47b059
|
@ -76,15 +76,14 @@ struct constructor_wrapper {
|
|||
};
|
||||
|
||||
template <typename... Functions>
|
||||
constructor_wrapper<Functions...> initializers(Functions&&... functions) {
|
||||
return constructor_wrapper<Functions...>(std::forward<Functions>(functions)...);
|
||||
inline auto initializers(Functions&&... functions) {
|
||||
return constructor_wrapper<std::decay_t<Functions>...>(std::forward<Functions>(functions)...);
|
||||
}
|
||||
|
||||
template <typename Function>
|
||||
struct destructor_wrapper {
|
||||
Function fx;
|
||||
template <typename... Args>
|
||||
destructor_wrapper(Args&&... args) : fx(std::forward<Args>(args)...) {}
|
||||
destructor_wrapper(Function f): fx(std::move(f)) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -93,7 +92,7 @@ struct destructor_wrapper<void> {};
|
|||
const destructor_wrapper<void> default_destructor{};
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user