Open grasph opened 11 months ago
Thanks for raising this issue. I came across the exact same question - have you found a way around this yet? Otherwise it would be great to learn if this is already possible or if there is another possibility to make it work in case of such mutually dependent types.
Hello Bart,
In the code generated by Wrapit and for non-parametric types, we proceed first with the wrap declaration (
add_type()
) of all types and proceed in the second step to the method declarations (method()
). This ensures that all types needed for a method are in place when declaring it.It does not work for non-parametric types because type declaration is finalized by the
apply()
call that declares also the methods. The methodapply()
cannot be called multiple times. Otherwise, we could call it with a functor that does nothing to proceed with the type declaration finalization. The call will also define the default methods, but that should not be a problem.Beyond convenience of a two-step approach, separation of type and method declaration is mandatory in case of cyclic dependency like in the example below.
Would it be possible to add support for multiple call to apply() or another way to allow a two-step declaration?
Let me know in case there is already a way to achieve this with the current CxxWrap version.
Regards,
Philippe.