tags:

views:

188

answers:

2

I'm sure there's some way to do this with the \defgroup, \addgroup and \@{ \@} tags, but after a couple of hours of trial and (obviously) error, I'm asking SO.....

I have:

class C {
public:
    void foo () const;
};

and I have some helper non-member functions that really are part of C's interface, but aren't in the class:

std::string
format (const C& c, const std::string &fmt);

I'd like the format function to appear on the same page as the class functions. Is that just not possible? Is the best I can do a "module" page, which lists C as a class (with a hyperlink to C's comments, and format as a function?

A: 

Creating a group and assigning functions outside of your class in that group will work, but in the class documentation itself, you won't get references to your functions unless you use commands such as @see or @sa. Honestly, because a function takes a documented parameter doesn't mean this function is automatically part of the library, but you can link both classes and functions together using @defgroup and @addgroup.

JP
If the function is in the same header file than the class definition, there is a high chance it should figure with the class in the documentation. See Herb Sutter's definition of 'public interface'.
Matthieu M.
As Matthieu says...... it's part of the interface. That's why I wanted to know if there's a way to get them to show up on the same page.
Eric H.
+2  A: 

\relates (or \memberof) seem to be what you are looking for.

Éric Malenfant
Um... yeah... now I feel like an idiot for missing that. I think I need to re-read the Special Commands section of the docs. I don't remember seeing \relates used in an example.
Eric H.