8000 idl writing of template class · Issue #9 · fabmax/webidl-util · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

idl writing of template class #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kong2456878740 opened this issue Feb 25, 2025 · 1 comment
Open

idl writing of template class #9

kong2456878740 opened this issue Feb 25, 2025 · 1 comment

Comments

@kong2456878740
Copy link

Hello, I tried to use the method described in your project to convert the cgal library, but some of the header files exist template class writing, the Internet said idl does not support generics, so I encountered difficulties when writing idl, I intercepted part of the code as follows, looking forward to getting a reply
`
template
class I_Polyhedron_vertex : public VertexBase {
public:
typedef VertexBase Base;
typedef typename Base::Point Point;
typedef Point Point_3;

public:
I_Polyhedron_vertex() {}
I_Polyhedron_vertex( const VertexBase& b) : VertexBase(b) {}
I_Polyhedron_vertex( const Point_3& p) : VertexBase(p) {}
}
`

@fabmax
Copy link
Owner
fabmax commented Feb 25, 2025

Yes, template classes won't work out of the box. A possible work around is to add typedefs to your native code for each template variant. I do something similar for my PhysX bindings:

// C++ code:
typedef physx::PxArray<physx::PxVec3> PxArray_PxVec3;

and then you can use the typedef type in your webidl definition:

// WebIDL code:
interface PxArray_PxVec3 {
    // ...
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0