Author Topic: Picking most likely overload for "Go to definition"  (Read 2131 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Picking most likely overload for "Go to definition"
« on: June 30, 2017, 03:28:06 PM »
Often times when browsing C++ code, I want to find the definition of a function. Unfortunately some functions are heavily overloaded, there are many versions of this function that take different parameter lists.

It would be useful when I do "Go to definition" (Ctrl+.), that if there are many overloads of the function then the most likely overloaded definition is shown at the top of the list of possible functions to go to. The most likely overloaded definition would be the one where the types of each parameter in the parameter list match the specific instance of where I am doing the Ctrl+. on.

Dennis

  • Senior Community Member
  • Posts: 3965
  • Hero Points: 517
Re: Picking most likely overload for "Go to definition"
« Reply #1 on: June 30, 2017, 05:36:46 PM »
There is a setting for that.

Document > C/C++ Options > Context Tagging(R) > Go to Definition > Attempt to filter out ...

If you have ever written a C++ compiler, you know that overload resolution is extremely complicated.  This feature does what it can, but it is definitely not perfect (and probably never will be).

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Picking most likely overload for "Go to definition"
« Reply #2 on: June 30, 2017, 05:43:04 PM »
Thanks for pointing this out, was not aware of it.

I tried it but it is not filtering my case. As you said it is not perfect, so that is probably why. I could try to extract it into a sample project,  but that could be time consuming for me.

In this case, it is a member function overload, probably doesn't make a difference but would like to know if member function overload is supported by this?

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: Picking most likely overload for "Go to definition"
« Reply #3 on: June 30, 2017, 07:37:24 PM »
Tried it again a few hours later, now it seems to be working! So maybe there is some latency between changing the option and when it actually works?

Thanks for this feature!