How to document function object using doxygen?

How do I document a functional object (AKA functor) using doxygen? It seems to me that misleading is just to document it as a regular class. I’m much better off thinking of a functional object as a function with closure than a called class.

Is there a way to document a function object that matches my preference?

class Adder { public: Adder( size_t x ) : m_x(x) { } size_t operator () ( size_t y ) const { return m_x + y; } private: const size_t m_x; }; 
+8
c ++ functor function-object doxygen
source share
3 answers

Give him class documentation, put the word functor in the first sentence (preferably as the first word), and skip the operator() documentation if the meaning is obvious.

Keep in mind: the value is not if the value of operator() overloaded.

+1
source share

You can use Doxygen member groups to group all your functors. Perhaps something like this will work:

 /// @name Functors /// @{ class Adder; /// @} /// Functor that adds a set value to its argument when called. class Adder { public: Adder( size_t x ) : m_x(x) { } size_t operator () ( size_t y ) const { return m_x + y; } private: const size_t m_x; }; 
+1
source share

Class documentation should be sufficient. Just describe the purpose and use and explain something useful. Overly detailed documentation of the obvious can be avoided.

 /*! \brief Adder functor * * Returns size_t sum of const member and parameter */ class Adder { public: //! Construct with constant value for subsequent sums Adder( size_t x ) : m_x(x) { } //! Call with value to compute with constant size_t operator () ( size_t y ) const { return m_x + y; } private: const size_t m_x; }; 
+1
source share

All Articles