In a library I'm developing, I often have this kind of code:
template<typename T = P, enable_if_c<has_V_field<T>> = detail::dummy>
constexpr std::size_t v(){
return T::V;
}
template<typename T = P, disable_if_c<has_V_field<T>> = detail::dummy>
constexpr std::size_t v(){
return 1;
}
The two functions do the same thing, but are enabled based on the type. I'd like to document only one of then and moreover, I would like if possible to show it in Doxygen without the template stuff, as constexpr std::size_t v()
. For the user, the templates here have not value at all.
Is that kind of thing possible with Doxygen ?
You can put example source code in a special path defined in the doxygen config under EXAMPLE_PATH , and then insert examples with the @example tag. Doxygen will then generate an extra page containing the source of the example. It will also set a link to it from the class documentation containing the example tag.
The statements in the file are case-sensitive. Comments may be placed anywhere within the file (except within quotes). Comments beginning with two hash characters ( ## ) are kept when updating the configuration file and are placed in front of the TAG they are in front of. Comments beginning with two hash characters ( ...
A special comment block is a C or C++ style comment block with some additional markings, so doxygen knows it is a piece of structured text that needs to end up in the generated documentation. The next section presents the various styles supported by doxygen.
You can put the function you'd like to see in a conditional section like so:
#ifdef DOXYGEN_ONLY
/*! documentation for v. */
constexpr std::size_t v();
#else // actual implementation with two variants selected via SFINAE
template<typename T = P, enable_if_c<has_V_field<T>> = detail::dummy>
constexpr std::size_t v(){
return T::V;
}
template<typename T = P, disable_if_c<has_V_field<T>> = detail::dummy>
constexpr std::size_t v(){
return 1;
}
#endif
and then use the following configuration settings:
ENABLE_PREPROCESSING = YES
PREDEFINED = DOXYGEN_ONLY
You may use \fn
: http://www.doxygen.nl/manual/commands.html#cmdfn
Something like: (untested)
/*! \fn template<typename T> constexpr std::size_t v()
* \brief A function.
* \return 1 or T::V.
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With