| 40 | /// \param[in] funcs the set of functions to dispatch on. |
| 41 | template<typename FunctionType> |
| 42 | std::function<FunctionType> functor(const std::vector<Const_Proxy_Function> &funcs, const Type_Conversions_State *t_conversions) |
| 43 | { |
| 44 | const bool has_arity_match = std::any_of(funcs.begin(), funcs.end(), |
| 45 | [](const Const_Proxy_Function &f) { |
| 46 | return f->get_arity() == -1 || size_t(f->get_arity()) == chaiscript::dispatch::detail::Arity<FunctionType>::arity; |
| 47 | }); |
| 48 | |
| 49 | if (!has_arity_match) { |
| 50 | throw exception::bad_boxed_cast(user_type<Const_Proxy_Function>(), typeid(std::function<FunctionType>)); |
| 51 | } |
| 52 | |
| 53 | FunctionType *p=nullptr; |
| 54 | return detail::build_function_caller_helper(p, funcs, t_conversions); |
| 55 | } |
| 56 | |
| 57 | /// Build a function caller for a particular Proxy_Function object |
| 58 | /// useful in the case that a function is being pass out from scripting back |
nothing calls this directly
no test coverage detected