How can I @ref a different variant of the same method?

Viewed 96

I'm writing doxygen comments for some C++ code. I have two functions:

/** Some existing doxygen comment */
int foo(int x);

/** Another existing doxygen comment */
int foo(
    this_signature y1,
    is_really_long y2, 
    and_to_be_honest y3, 
    i_would y4, 
    really_rather y5, 
    avoid_repeating_it y6);

/** This is what I'm writing now */
int foo(double z);

In the doxygen comment for the second function, I want to refer, @ref, to the second function, or rather the second variant of the function. How do I do this?

Note: I am particularly (bot not solely) interested in a solution which would not be extremely verbose (considering the long signature of the second function).

1 Answers

It it (like @Scheff wrote) possible to reference by means of the signature. So something like:

/** Fie to show reference:
  *
  * \ref foo(unsigned long)
  *
  * \ref foo(unsigned long y)
  */
void fie(void);

See also http://www.doxygen.nl/manual/autolink.html#linkfunc.

Regarding comment about long signatures, either use the \anchor possibility as suggested by @Scheff though, in my opinion, at first it looks a good solution but it is less maintainable (the signature variant is checked on existence when the documentation is generated, but the string in the of the \ref of the \anchor isn't (and you probably would need something like: \ref my_anch "foo(unsigned long y)" as otherwise (\ref my_anch) the link will have the name my_anch .

Related