I'm trying to implement a for_each
method for my personal script array, but I don't know how to properly write its declaration for RegisterObjectMethod
. I have tried to write declaration like void for_each(void (const T&in)@ fn)
or void for_each(void(@)(const T&in))
but it didn't work.
My current workaround is to register it as void for_each(?&in)
and then handle the type information inside a wrapper. But my implementation has some problem. It can only accept a normal function. Once I pass a delegate, it explodes with segfault.
Link to my code for the wrapper
So my question is 1. how to register a templated funcdef, or 2. if a templated funcdef is not supported, how to write a function with ?&in
parameter that handles the input correctly?