Skip to content

Commit 0cb3884

Browse files
committed
Fix constructor embind
Adds the removed method from ecb7bb3#diff-b89415f247dd9bc4a13f065288c5e651
1 parent 4362ff3 commit 0cb3884

File tree

1 file changed

+18
-0
lines changed
  • system/include/emscripten

1 file changed

+18
-0
lines changed

system/include/emscripten/bind.h

+18
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,24 @@ namespace emscripten {
14751475
return *this;
14761476
}
14771477

1478+
template<typename... Args, typename ReturnType, typename... Policies>
1479+
EMSCRIPTEN_ALWAYS_INLINE const class_& constructor(ReturnType (*factory)(Args...), Policies...) const {
1480+
using namespace internal;
1481+
1482+
// TODO: allows all raw pointers... policies need a rethink
1483+
typename WithPolicies<allow_raw_pointers, Policies...>::template ArgTypeList<ReturnType, Args...> args;
1484+
auto invoke = &Invoker<ReturnType, Args...>::invoke;
1485+
_embind_register_class_constructor(
1486+
TypeID<ClassType>::get(),
1487+
args.getCount(),
1488+
args.getTypes(),
1489+
getSignature(invoke),
1490+
reinterpret_cast<GenericFunction>(invoke),
1491+
reinterpret_cast<GenericFunction>(factory));
1492+
1493+
return *this;
1494+
}
1495+
14781496
template<typename SmartPtr, typename... Args, typename... Policies>
14791497
EMSCRIPTEN_ALWAYS_INLINE const class_& smart_ptr_constructor(const char* smartPtrName, SmartPtr (*factory)(Args...), Policies...) const {
14801498
using namespace internal;

0 commit comments

Comments
 (0)