Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doxygen document c++ class templates

Im trying to document the following:

template <class T, int NDim>
class myClass {

public:
.
.

here's the doxygen

/*!
 * \class myClass<T, NDim>
 * \brief Defines a class for stuff. 
*/

Generation yields:

myClass Class Reference

Defines a class for stuff.

So i'm missing the template information, but thats not the end of the world since i know that doxygen doesn't deal with templates well. The main problems is the warning during generation:

myClass.h:2: warning: the name `T' supplied as the argument of the \class, \struct, \union, or \include command is not an input file

How can i resolve this warning?

like image 652
ldgorman Avatar asked Nov 17 '14 14:11

ldgorman


Video Answer


1 Answers

AFAIK it's not necessary to specify \class explicitly, doxygen should detect the class name automatically, as long you put the documentation immediately before the template class declaration

/** << NOTE
 * \brief Defines a class for stuff. 
 * \tparam T Type to work with.
 * \tparam NDim Number of dimensions.
 */
template <class T, int NDim>
class myClass {

public:
.
.
};

To specify documentation for template parameters use \tparam.

Also note: Usage of < and > will be interpreted as inline HTML tags by doxygen. Use \< and \> instead.

like image 70
πάντα ῥεῖ Avatar answered Sep 24 '22 14:09

πάντα ῥεῖ