Template declarations for structures and classes follow a special layout in CoDiPack. There are three rules any developer needs to follow:
T_
.T_
prefix.The first two rules are simple and an example is:
The third rule is in place to allow for auto completion in IDEs on template arguments. In your IDE you can use the preprocessor flag -DCODI_IDE=1
to enable this feature. In order for the IDEs to be able to know about the template type the default type declarations are required. CoDiPack defines preprocessor helpers to declare these in the file macros.hpp. All declarations have to use CODI_DECLARE_DEFAULT
or short CODI_DD
. The first argument is the template argument and the second argument is the default type declaration. Since the preprocessor engine does not know about templates, template argument lists are parsed as arguments to the preprocessor macro. It is therefore necessary to wrap these declarations in CODI_TEMPLATE
or short CODI_T
macros. While using defining the defaults for CODI_IDE
the clangd compatibility should be kept in mind. This may make it necessary to not declare a default template argument in special cases.
Example declarations are