C++ meta-programming doxygen documentation

后端 未结 4 1040
深忆病人
深忆病人 2020-12-05 10:55

I am documenting some code which uses meta-programming heavily, for example:

 template

        
4条回答
  •  一整个雨季
    2020-12-05 11:38

    Here is my take on it:

    ///
    /// \defgroup Kernel Kernel
    ///
    /// \brief Kernel does this and that
    /// \{
    
    /// \brief Kernel template class brief description.
    template
    struct Kernel
    {};
    
    /// \brief Kernel partial template specialization brief description.
    ///
    /// More detailed description...
    /// Partially specializes Kernel with meta::braket.
    /// If quadrature, Transform\> is true then enable /// this algorithm, otherwise enable this other algorithm.
    /// Inherits privately from template class Eri
    /// \tparam A template parameter A of type rysq::type, documentation and concepts /// \tparam B template parameter B of type rysq::type, documentation and concepts /// \tparam C template parameter C of type rysq::type, documentation and concepts /// \tparam D template parameter D of type rysq::type, documentation and concepts /// \tparam Transform template parameter class Transform documentation and concepts /// \see Kernel\ /// \see Eri /// \see meta::braket /// \see quadrature #ifdef DOXY // This is the documentation version template struct Kernel #else // This is what gets compiled template struct Kernel, Transform,typename boost::enable_if, Transform> >::type> #endif : Eri {}; /// \}

    Don't forget to add DOXY in the PREDEFINED section of Doxygen's preprocessor.

    I usually prefer to hide implementation details from the user of my code, so I change what Doxygen sees. In this case, you will find all your specializations under one group, the Kernel group, and under the class list, all specializations will be grouped together and won't have a very long and un-comprehensible name.

    Hope it helps.

提交回复
热议问题