Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Copy type of function parameter to clipboard
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

joostn
Junior Member

16 Posts

Posted - Mar 17 2015 :  07:20:24 AM  Show Profile  Reply with Quote
Perhaps this is also worth considering: being able to copy the fully expanded type name of a parameter to a function.

Suppose I have this class:

template <class T>
class TThing
{
  void DoSomething(int i, std::shared_ptr<std::vector<T> > vec);
};


Now when I start typing:
TThing<bool> mything;
DoSomething(5,

it would be nice to be able to paste the fully expanded type of the function parameter:
std::shared_ptr<std::vector<bool> >
because I might need to declare a temporary object of this type prior to calling DoSomething.

Or perhaps for simplicity just a 'copy function signature to clipboard' feature: when right clicking on DoSomething this would copy the function signature (with all templates fully expanded):
void DoSomething(int i, std::shared_ptr<std::vector<bool> > vec)
so I can cut/paste from this manually.

This might be complicated if a function is overloaded, but even if it would only work for non-overloaded functions this would be useful.

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Mar 17 2015 :  11:11:46 PM  Show Profile  Reply with Quote
Place the caret into the function call "mything.DoSomething()" and look at the VA definition field, which is normally at the top of the editor, on the right hand side. For the test code:

TThing<bool> myThing;
myThing.DoSomething()

VA is giving me:

void DoSomething(int i, std::shared_ptr<std::vector<bool> > vec)

you can place focus into the definition field, and copy this expanded signature from there into the clipboard, or just select and copy the part that you want.

For overloaded functions, use the pull down arrow at the end of the definition field, to see the different overloads that VA knows about. I think this does what you are looking for.

zen is the art of being at one with the two'ness

Edited by - feline on Mar 17 2015 11:12:46 PM
Go to Top of Page

joostn
Junior Member

16 Posts

Posted - Mar 18 2015 :  10:18:38 AM  Show Profile  Reply with Quote
That's very useful! I hadn't found this yet. Thanks.

It doesn't work however for this case (http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern):
template <class T>
class BBB
{
};

template <class T>
class AAA  : public BBB<AAA<T> >
{
public:
  inline AAA(){}
  inline T GetValue() const
  {
    return (T)0;
  }
};

void test()
{
  AAA<double> d;
  d.GetValue();
}


If I click on d.GetValue() the VA definition stays empty.
If i remove the public BBB<AAA<T> > inheritance it works.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Mar 19 2015 :  12:27:35 AM  Show Profile  Reply with Quote
Do you have much code like this?

Have you considered using the "auto" keyword, to get hold of complex types without to much difficulty?

zen is the art of being at one with the two'ness
Go to Top of Page

joostn
Junior Member

16 Posts

Posted - Mar 19 2015 :  04:10:35 AM  Show Profile  Reply with Quote
Hi Feline,

It's definitely a bug, I'm also encountering problems when refactoring this code.
But please consider my original feature request closed, the VA definition window is a perfect solution to my problem.

I've posted a new bug report here:
http://forums.wholetomato.com/forum/topic.asp?TOPIC_ID=12231
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18724 Posts

Posted - Mar 19 2015 :  5:41:48 PM  Show Profile  Reply with Quote
I am glad this is helping, thank you for the update. This bug will be studied in the other thread, this keeps things separate and a bit easier to track

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000