clap_plugin_factory
functions take itself as a parameter?
#243
-
Why does |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It is possible to have several factories and you might need to address the factory, imagine it as a "this" pointer. The parameter is not used in the template since it has only one factory, but more complex plugin libraries are possible where the appropriate factory needs to be selected. In general it is also useful not to have a simple data member but a function which can determine things at runtime (like licenses, dynamic wrappers etc.). This way you can set up the structs as static/const and keep the flexibility without the necessity of code that just prepares structs. |
Beta Was this translation helpful? Give feedback.
It is possible to have several factories and you might need to address the factory, imagine it as a "this" pointer. The parameter is not used in the template since it has only one factory, but more complex plugin libraries are possible where the appropriate factory needs to be selected.
In general it is also useful not to have a simple data member but a function which can determine things at runtime (like licenses, dynamic wrappers etc.). This way you can set up the structs as static/const and keep the flexibility without the necessity of code that just prepares structs.