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
 Technical Support
 Lamba params autocomplete
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

swinefeaster
Tomato Guru

310 Posts

Posted - Apr 30 2020 :  2:30:57 PM  Show Profile  Reply with Quote
Feature suggestion for VAX. When I use c++ lambdas, I often find myself having to manually type in the lambda function parameter list. It would be great if I could autocomplete that with tab using visual assist.

when I type:


foo ([&](


i get a tooltip showing the lambda args. i wish i could just hit Tab to get:


foo ([&](int param)

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - May 01 2020 :  05:03:42 AM  Show Profile  Reply with Quote
I am still new to C++ lambdas, but this is a valid piece of code that I have worked out, while reading up on them:

std::vector<std::string> vecFileNames;

// using Lambda function to set the function called as the "for_each" iterates across
// the vector.  "currentFileName" is parameter, and it is only in scope inside
// the curly brackets defining the Lambda function body
std::for_each(vecFileNames.begin(), vecFileNames.end(), [&](const std::string ¤tFileName)
	{
		if (currentFileName.length() > 0)
		{
			// got a file name we can do something with here
		}
	});

the "[&]" means that variables defined outside of the lambda function are available inside the lambda function, but the parameter to the function, "currentFileName" in this example, does not exist outside of the function, and is created at this point. So we are creating new variable names here, so anything VA suggests is likely to be incorrect, since we have no reason to assume you are about to type a known symbol.

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