Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doxygen C++ inline template documentation

Is there some way to document template parameters like this:

template<
    int N, ///< description
    typename T ///< description
>

rather than listing each parameter with tparam?

please note that function arguments can be documented like this in current doxygen:

void function(int a /**< description */);

if there is not one, how hard would be to implement it? if you are familiar with doxygen internals, can you point me in the direction where to implement it.

thank you

like image 766
Anycorn Avatar asked May 30 '10 17:05

Anycorn


People also ask

What is @brief in C?

Putting the command @brief will generate a short description of the function when you generate the doxygen documentation. That short description can be extended if you want.

Can doxygen generate markdown?

Doxygen is a well-known tool for generating documentation directly out of the annotated source code. However, it can be utilized to create technical documentation, too. In version 1.8. 0, Markdown support was introduced to Doxygen.

How do I comment out a code in doxygen C++?

Once specified, you can generate the comment stub by typing the respective “///” or “/**” above a function, or by using the (Ctrl+/) shortcut.


1 Answers

There is no way to document your template parameters like you described.

I would say it is not a good idea, because then you would document your template parameters differently from your usual parameters, and why would you want that?

Usually it looks like this:

/*! \p transpose : transpose a matrix
 *
 * \param A input matrix
 * \param At output matrix (transpose of A)
 *
 * \tparam MatrixType1 matrix
 * \tparam MatrixType2 matrix
 */

template <typename MatrixType1, typename MatrixType2>
void transpose(const MatrixType1& A, MatrixType2& At);

and you want it to look like this?!

/*! \p transpose : transpose a matrix
 *
 * \param A input matrix
 * \param At output matrix (transpose of A)
 *
 */

template <
  typename MatrixType1, ///< matrix
  typename MatrixType2  ///< matrix
>
void transpose(const MatrixType1& A, MatrixType2& At);

Why?

like image 74
arturh Avatar answered Sep 25 '22 17:09

arturh