Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 afx_msg prefix when extracting method

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
AdrianH Posted - Sep 27 2013 : 12:29:32 PM
I just extracted a method and part of the signature from the function I extracted from showed in the extracted method's signature.

Is that by design? What was the rational behind that?

Thanks,


A
3   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Sep 27 2013 : 5:33:42 PM
I wasn't able to reproduce the problem using your source or 2 different sample code:

I extracted the for_each:

int main() 
{
   // Create a vector object that contains 10 elements.
   vector<int> v;
   for (int i = 0; i < 10; ++i) {
      v.push_back(i);
   }

   // Count the number of even numbers in the vector by 
   // using the for_each function and a lambda.
   int evenCount = 0;
   for_each(v.begin(), v.end(), [&evenCount] (int n) {
      cout << n;

      if (n % 2 == 0) {
         cout << " is even " << endl;
         ++evenCount;
      } else {
         cout << " is odd " << endl;
      }
   });

   // Print the count of even numbers to the console.
   cout << "There are " << evenCount 
        << " even numbers in the vector." << endl;
}


I extracted the whole body of func4:

void func4(std::vector<double>& v) {
	std::transform(v.begin(), v.end(), v.begin(),
		[](double d) -> double {
			if (d < 0.0001) {
				return 0;
			}
			else {
				return d;
			}
	});
}


Neither picked up the parameters of lambda using Visual Assist 2001. Which build are you using? Which Visual Studio are you using?
Can you please try if VA picks up the params using the above samples? If not, can you please try creating a complete, compiling small sample that picks up the params of a lambda?
AdrianH Posted - Sep 27 2013 : 1:02:51 PM
Oh, it must be getting confused with the lambda. Probably why it also pulled out the hItem as a HTREEITEM& parameter.


A
AdrianH Posted - Sep 27 2013 : 12:44:53 PM
Oh wait, it did more than that. Here is part of my function:

BOOL CIntegrityErrorDlg::OnIntegritycontextmenuFilter(UINT id)
{
//...
	// restore new caret location
	hItem = m_DiagItems.findNode(m_DiagItems.GetRootItem(), CCWMultiColumnTreeCtrl::forwards, 20
		, [&nodeString](CCWMultiColumnTreeCtrl& rTree, HTREEITEM hItem)
	{
		return rTree.GetItemText(hItem) == nodeString;
	});
	m_DiagItems.Select(hItem, TVGN_CARET);
	m_DiagItems.EnsureVisible(hItem);

	m_Reset.ShowWindow(SW_SHOW);
	// unfreeze tree
	m_DiagItems.SetRedraw(TRUE);
	// invalidate tree control.
	m_DiagItems.Invalidate();
	return TRUE; // stop handling this message
}


and this is what I got:

class CIntegrityErrorDlg : public CGRPlusDialog
{
//...
	afx_msg BOOL restoreCaret( HTREEITEM &hItem, CString nodeString );
//...
};

BOOL CIntegrityErrorDlg::OnIntegritycontextmenuFilter(UINT id)
{
//...
	// restore new caret location
	return restoreCaret(hItem, nodeString);

	m_Reset.ShowWindow(SW_SHOW);
	// unfreeze tree
	m_DiagItems.SetRedraw(TRUE);
	// invalidate tree control.
	m_DiagItems.Invalidate();
	return TRUE; // stop handling this message
}

BOOL CIntegrityErrorDlg::restoreCaret( HTREEITEM &hItem, CString nodeString )
{
	hItem = m_DiagItems.findNode(m_DiagItems.GetRootItem(), CCWMultiColumnTreeCtrl::forwards, 20
		, [&nodeString](CCWMultiColumnTreeCtrl& rTree, HTREEITEM hItem)
	{
		return rTree.GetItemText(hItem) == nodeString;
	});
	m_DiagItems.Select(hItem, TVGN_CARET);
	m_DiagItems.EnsureVisible(hItem);
}

So, it wasn't at the end of the function and the code highlighted wasn't being assigned to anything, so why did it return a BOOL? It should have returned void.

Also it put a return in the middle of the function. Not sure what that's about.


A

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000