In order to link to templated C++ classes within Doxygen-generated documentation, simply refer to the class as though it were not templated at all. Doxygen will kindly pick up on the reference and link appropriately. Though this may seem obvious to some, it’s definitely not to others. Read on for an example including code.
Example
Suppose you have a class defined as follows:
template <class T> class Foo {};You might use the class as follows:
/** A Foo pointer with @c int as the template parameter. */ Foo<int> *myFoo;
The comment above is correctly interpreted by Doxygen and, if enabled, will automatically link the text Foo to the documentation for the Foo<T> class.
0 Responses to “Quick Tip: Link to Templated Classes in Doxygen”