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
 afx_msg prefix when extracting method
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AdrianH
Ketchup Master

Canada
71 Posts

Posted - Sep 27 2013 :  12:29:32 PM  Show Profile  Reply with Quote
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

AdrianH
Ketchup Master

Canada
71 Posts

Posted - Sep 27 2013 :  12:44:53 PM  Show Profile  Reply with Quote
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
Go to Top of Page

AdrianH
Ketchup Master

Canada
71 Posts

Posted - Sep 27 2013 :  1:02:51 PM  Show Profile  Reply with Quote
Oh, it must be getting confused with the lambda. Probably why it also pulled out the hItem as a HTREEITEM& parameter.


A
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 27 2013 :  5:33:42 PM  Show Profile  Reply with Quote
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?

Edited by - accord on Sep 27 2013 5:36:07 PM
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