diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 44c4b61cd..8cccd4c38 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -51,9 +51,14 @@ public: } /// Construct a cpp_function from a lambda function (possibly with internal state) - template ::type::operator())>::type> + template ::type, + std::is_function, std::is_pointer, std::is_member_pointer + >::value> + > cpp_function(Func &&f, const Extra&... extra) { + using FuncType = typename detail::remove_class::type::operator())>::type; initialize(std::forward(f), (FuncType *) nullptr, extra...); }