Fix for preexec_func (#19)

This commit is contained in:
ilue 2018-12-22 03:07:51 +08:00 committed by Arun Muralidharan
parent 899e9b997d
commit 0894e7f6db

View File

@ -608,7 +608,7 @@ public:
preexec_func() {}
template <typename Func>
preexec_func(Func f): holder_(new FuncHolder<Func>(f))
preexec_func(Func f): holder_(new FuncHolder<Func>(std::move(f)))
{}
void operator()() {
@ -621,8 +621,8 @@ private:
};
template <typename T>
struct FuncHolder: HolderBase {
FuncHolder(T func): func_(func) {}
void operator()() const override {}
FuncHolder(T func): func_(std::move(func)) {}
void operator()() const override { func_(); }
// The function pointer/reference
T func_;
};