Use preprocessor macros. Here's an example from the not-yet-official Boost.XInt library (presently queued for review for inclusion in Boost):
#ifdef BOOST_XINT_DOXYGEN_IGNORE
// The documentation should see a simplified version of the template
// parameters.
#define BOOST_XINT_INITIAL_APARAMS ...
#define BOOST_XINT_CLASS_APARAMS ...
#define BOOST_XINT_CLASS_BPARAMS other
#define BOOST_XINT_APARAMS ...
#define BOOST_XINT_BPARAMS other
#else
#define BOOST_XINT_INITIAL_APARAMS \
class A0 = parameter::void_, \
class A1 = parameter::void_, \
class A2 = parameter::void_, \
class A3 = parameter::void_, \
class A4 = parameter::void_, \
class A5 = parameter::void_
#define BOOST_XINT_CLASS_APARAMS class A0, class A1, class A2, class A3, \
class A4, class A5
#define BOOST_XINT_APARAMS A0, A1, A2, A3, A4, A5
#define BOOST_XINT_CLASS_BPARAMS class B0, class B1, class B2, class B3, \
class B4, class B5
#define BOOST_XINT_BPARAMS B0, B1, B2, B3, B4, B5
#endif
Use the #define
d macro names instead of the template parameters, everywhere you need them, like so:
/*! \brief The integer_t class template.
This class implements the standard aribitrary-length %integer type.
[...lots more documentation omitted...]
*/
template<BOOST_XINT_INITIAL_APARAMS>
class integer_t: virtual public detail::integer_t_data<BOOST_XINT_APARAMS>,
public detail::nan_functions<detail::integer_t_data<BOOST_XINT_APARAMS>::
NothrowType::value, // ...lots more base classes omitted...
{
// ...etcetera
And put lines like these in the Doxyfile:
PREDEFINED = BOOST_XINT_DOXYGEN_IGNORE
EXPAND_AS_DEFINED = BOOST_XINT_INITIAL_APARAMS \
BOOST_XINT_CLASS_APARAMS \
BOOST_XINT_CLASS_BPARAMS \
BOOST_XINT_APARAMS \
BOOST_XINT_BPARAMS
The result is that Doxygen sees either "..." or "other" for the template parameters, and the compiler sees the real ones. If you describe the template parameters in the documentation for the class itself, then the user of the library will only need to see them in the one place that he's likely to look for them; they'll be hidden everywhere else.
As an additional advantage to this design, if you ever need to make changes to the template parameter lists, you only need to change them in the macro definitions and the functions that actually use the changed parameters. Everything else will adapt automatically.