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
 Refactoring Hidden Constructor and operator=
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

lutherbaker
New Member

2 Posts

Posted - Sep 05 2007 :  10:42:47 PM  Show Profile  Reply with Quote
In Visual Studio 2003/2005 (C++) - I can create a class. I hide both the Copy Constructor and operator=(Obj& obj) method by declaring them in the private section - and not implementing them.

For example:

namespace a {

namespace b {

namespace c {

class OldName
{

public:

OldName() { }

private:

OldName(const OldName&);

OldName& operator=(const OldName&);

};

}

}

}




Now, refactor the name of the class by hovering over the "class OldName" section, clicking the arrow and changing the class name.

You will find all the type names change EXCEPT the arguments in the in hidden constructor and operator methods. They remain OldName. Mind you, the name of the copy constructor and return value of the operator=(const OldName&) do indeed change.

Hope that helps,

-Luther


namespace a {

namespace b {

namespace c {

class NewName
{

public:

NewName() { }

private:

NewName(const OldName&);

NewName& operator=(const OldName&);

};

}

}

}

tailsu
Senior Member

37 Posts

Posted - Sep 06 2007 :  04:31:07 AM  Show Profile  Reply with Quote
For creating noncopyable classes I'd suggest inheriting from boost::noncopyable from the Boost.Utility library
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Sep 06 2007 :  08:21:36 AM  Show Profile  Reply with Quote
This is a known bug. VA is confused since there is no parameter name. I know you don't need a parameter name for this to compile, but until this bug is fixed you need to add a parameter name for rename to work correctly. So change the code to read:

        OldName(const OldName&rhs);
        OldName& operator=(const OldName&rhs);


case=3027

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

lutherbaker
New Member

2 Posts

Posted - Sep 07 2007 :  6:55:49 PM  Show Profile  Reply with Quote
No problem. Thanks much.

-Luther
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Nov 12 2010 :  3:36:21 PM  Show Profile  Reply with Quote
case=3027 is fixed in build 1836

Whole Tomato Software, Inc.
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