-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the best way to resolve the Warning re: multiple matches for a function? #289
Comments
Hey, good question. Normally by providing more details about the function arguments. If you're only supplying the function name and it is an overloaded function then you will get that warning (I think!) so you have to provide the full signature that matches the overload that you want. That is off the top of my head, does it seem to fit your case? |
In my case, it is a template function that is specialized for multiple types. |
Ok, I'm not sure that has been tested properly. Would you consider providing a test case in the examples section and would reproduce the issue that you are seeing? |
Simply overriding a function namespace bar
{
template <class T>
auto xt::foo(T);
template <class T>
auto xt::foo(std::vector<T>);
} and .. doxygenfunction:: bar::foo
:project: baz yields
|
The following should fix the problem: .. doxygenfunction:: bar::foo(T)
:project: baz
.. doxygenfunction:: bar::foo(std::vector<T>)
:project: baz You have to be very careful with white spaces so the doxygenfunction declaration exactly matches the cpp function declaration. |
Is there another way to distinguish functions? I have the same problem with functions that are enable_if'd based on the template type. E.g.:
The signature is obviously exactly the same, but I'd like to select the first one to get the documentation from. |
Using the |
On a similar note, I can't seem to be able to reference the second overload in the following case: namespace dab
{
struct device
{
virtual bool gain(gain gain) = 0;
virtual dab::gain gain() const = 0;
};
} What would be the appropriate way to reference the second overload? I tried:
but none of them work. The first two give the error, that there are multiple candidates, while the third one (obviously) can't resolve the function. |
I also found that leaving the argument names in the signature (in the rst) creates this error. |
Primarily because of @wolfv 's comment above I think this can be improved in Breathe. Either by stripping names somehow or at the very least documenting this behaviour better. |
I've got this issue too. The way I'm working around it is by putting the various overloads in a dedicated Doxygen group, and by using .. doxygengroup:: buffer-allocation-functions
:project: arrow_cpp
:content-only: However, it would be nice to automatically emit documentation for all overloads of a function (perhaps using a separate directive or a dedicated option to |
Got this problem recently, but I am in somehow "mixed" situation. I really do not like breathes index, so I am writing my python script to parse doxygen .xml and generate appropiate .rst structure I want. (Which btw is much simpler than expected) Thing is: given that I actually do have specific refid of the overload (algorithm_8h_1a5861adad19739be6645aa5e03f032f77) is there a sane way to load the function by this? (or any other parameter in .xml of that namespace) |
I also encountered this when using the detection idiom, although in my case it's in combination with #441 :
Gives rise to this:
I'm not sure how to apply the comments above to this specific case. The two
|
I have a problem that is related, therefore I will put it here instead of opening a new issue. I am also not sure if it is more breathe or sphinx related issue. I have the following C++ overload: template< typename T, typename Visitor >
auto visit( T& object, Visitor visitor ) -> std::enable_if_t<
std::is_base_of_v< typename T::VisitorType, Visitor >,
typename Visitor::ReturnType >
{
object.accept( visitor );
if constexpr ( !std::is_same_v< void, typename Visitor::ReturnType > )
return visitor.result;
}
template < typename T, typename... Fs >
auto visit( T& object, Fs... fs ) {
return visit( object, T::VisitorType::make( fs... ) );
} When I put them in my .. doxygenfunction:: atoms::visit(T &object, Fs... fs)
:project: lib
.. doxygenfunction:: atoms::visit(T &object, Visitor visitor) -> std::enable_if_t<std::is_base_of_v<typename T::VisitorType, Visitor>, typename Visitor::ReturnType>
:project: lib I get the following warning:
But the generated documentation seems to be correct. I think the warning is a bug. Is there a way to solve this warning? I am using the latest version of sphinx from branch "3.x" and breathe version 4.1.18 (PyPi latest version). |
I'm quite sure this is a Breathe issue. From #512: If I understand correctly, the idea is that
Here the overloading is due to differences in the template parameter lists. So I guess there should be a third shape the directive argument can take, which is a full function signature? |
I think having the third option makes sense for C++. Also, what would make sense to me is to have a directive, which wouldn't issue a warning but instead, listed all the overloads of function/class/struct. |
After a bit more thinking, I think this is a bit more complicated. The |
IMHO having a |
Fix released in Breathe 4.25.0, let me know if there are any issues still. |
Note, this is technically not fully resolved, but it may be best to open another issue targeted towards the missing pieces, with examples. |
WARNING: doxygenfunction: Unable to resolve multiple matches for function
The text was updated successfully, but these errors were encountered: