4

Given some code like in the following example:

class MyClass;

class Injector {
    /**
     * @brief MyClass addition.
     */
    friend MyClass operator+(MyClass a, MyClass b) { ... }
};

class MyClass: private Injector {};

How can I make doxygen include the documentation of operator+() on the documentation page of the MyClass class? Functionally it clearly belongs there. Is there some general way to make doxygen document functionality available through ADL?

A useful example in the real world: I'd like doxygen to include operators provided by the base classes in boost/operators.hpp.

1 Answer 1

2

The /relates tag was designed for something close to that.

class MyClass;

class Injector {
    /**
     * @brief MyClass addition.
     * @relates MyClass
     */
    friend MyClass operator+(MyClass a, MyClass b) { ... }
};

class MyClass {};

This won't put the documentation on the same page, but will produce a "related functions" section on that same page, which links to the function.

http://www.doxygen.nl/manual/commands.html#cmdrelates

Sign up to request clarification or add additional context in comments.

2 Comments

This does seem to be a straightforward approach, however it does not work in the case of boost/operators.hpp. How can I include documentation when the injector class is part of an external codebase?
Also, it doesn't work with the provided example. Doxygen keeps putting the docs with Injector (under the related section).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.