diff --git a/include/pocketpy/any.h b/include/pocketpy/any.h index 82cad27b..317d2830 100644 --- a/include/pocketpy/any.h +++ b/include/pocketpy/any.h @@ -103,31 +103,4 @@ struct function{ } }; -template -struct lightfunction; - -template -struct lightfunction{ - void* _impl; - Ret (*_wrapper)(void*, Params...); - - lightfunction() : _impl(nullptr), _wrapper(nullptr) {} - - explicit operator bool() const { return _wrapper != nullptr; } - - template - lightfunction(const F& f){ - _impl = (F*)(&f); - _wrapper = [](void* impl, Params... params) -> Ret{ - F* f = (F*)(impl); - return (*f)(std::forward(params)...); - }; - } - - Ret operator()(Params... params) const{ - if(!_wrapper) throw std::runtime_error("empty function"); - return _wrapper(_impl, std::forward(params)...); - } -}; - } // namespace pkpy \ No newline at end of file