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
 Move implementation to source for friend operator
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

__Daniel__
Senior Member

Poland
36 Posts

Posted - Jan 17 2012 :  08:00:41 AM  Show Profile  Reply with Quote
Hello.

Latest version of VA.


class CTest
{
public:
	friend CTest operator*( const CTest& crLeft, const CTest& crRight )
	{
		return crLeft * crRight;
	}
};


Use "move implementation..."
cpp:

friend CTest std::operator*( const CTest& crLeft, const CTest& crRight )
{
	return crLeft * crRight;
}


"friend" and "std"?

EDIT:
When CTest is in namespace in cpp it appears outside namespace

Edited by - __Daniel__ on Jan 17 2012 08:08:49 AM

feline
Whole Tomato Software

United Kingdom
19076 Posts

Posted - Jan 17 2012 :  3:08:23 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description. The problem with "friend" and "std::" is:

case=2962

For the namespace problem, how is the cpp file set? Are you using a "using namespace" line? Do you have the namespace inside the cpp file?

Using a very simple test, and avoiding friend functions to try and pin down just the namespace effect, I have added the following code to a C++ header file:

namespace testMoveImpSpace
{
	class CTestMove
	{
		int moveMemberFunc() { return 1; }
	};
}

and when I trigger Move Implementation to Source File on this member function the namespace is correctly added before the class name on the implementation in the cpp file.

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

__Daniel__
Senior Member

Poland
36 Posts

Posted - Jan 18 2012 :  01:50:11 AM  Show Profile  Reply with Quote
quote:

For the namespace problem, how is the cpp file set? Are you using a "using namespace" line? Do you have the namespace inside the cpp file?



cpp with namespace:

namespace Test1
{

}

friend CTest std::operator*( const CTest& crLeft, const CTest& crRight )
{
	return crLeft * crRight;
}

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19076 Posts

Posted - Jan 18 2012 :  1:34:05 PM  Show Profile  Reply with Quote
Thank you for the clear description, I am seeing the same problem here, and it does seem to be a friend function specific bug:

case=64095

Are you aware that you can use VA Outline to help you move the friend function implementation into the namespace, after it has been created?

http://www.wholetomato.com/products/features/vaoutline.asp

Hopefully this will help a bit.

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

Edited by - feline on Jan 18 2012 1:35: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