Skip to content

Commit

Permalink
function-unwrap now returns a lambda (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ftk committed Jul 28, 2020
1 parent db6d0b7 commit 5b8cd65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions quickjspp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,14 +1214,14 @@ struct js_traits<Value>
}
};

/** Convert to/from std::function
/** Convert to/from std::function. Actually accepts/returns callable object that is compatible with function<R (Args...)>.
* @tparam R return type
* @tparam Args argument types
*/
template <typename R, typename... Args>
struct js_traits<std::function<R(Args...)>>
{
static std::function<R(Args...)> unwrap(JSContext * ctx, JSValueConst fun_obj)
static auto unwrap(JSContext * ctx, JSValueConst fun_obj)
{
return [jsfun_obj = Value{ctx, JS_DupValue(ctx, fun_obj)}](Args&& ... args) -> R {
const int argc = sizeof...(Args);
Expand Down

0 comments on commit 5b8cd65

Please sign in to comment.