| 367 | */ |
| 368 | template <typename TCallable, typename... Args> |
| 369 | static auto FromPackedInplace(Args&&... args) { |
| 370 | // We must ensure TCallable is a value type (decay_t) that can hold the callable object |
| 371 | static_assert(std::is_same_v<TCallable, std::decay_t<TCallable>>); |
| 372 | static_assert(std::is_invocable_v<TCallable, const AnyView*, int32_t, Any*>); |
| 373 | using ObjType = details::FunctionObjImpl<TCallable>; |
| 374 | Function func; |
| 375 | auto obj_ptr = make_object<ObjType>(std::forward<Args>(args)...); |
| 376 | auto* call_ptr = obj_ptr->GetCallable(); |
| 377 | func.data_ = std::move(obj_ptr); |
| 378 | return std::make_tuple(std::move(func), call_ptr); |
| 379 | } |
| 380 | |
| 381 | /*! |
| 382 | * \brief Create ffi::Function from a C style callbacks. |
nothing calls this directly
no test coverage detected