Author |
Topic |
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Oct 09 2006 : 07:57:55 AM
|
I used the rename functionality on a template class in order to rename it from Array to HArray. It didn't work correctly for functions that take the class as parameter:
template <class T>
class HArray {
HArray(const Array<T>&);
HArray<T>& operator = (const Array<T>&);
...
} As you can see, the parameter types are still Array and not HArray.
VC6, Win XP, no further add-ins.
Regards, Marcus. |
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 09 2006 : 1:44:04 PM
|
confirmed
case=2911
interestingly, if you put spaces in the parameter types, changing from "Array<T>" to "Array <T>" VA finds and renames Array in the parameter list. |
zen is the art of being at one with the two'ness |
|
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Oct 09 2006 : 3:49:56 PM
|
So, we have a workaround:
1.) Rename all "<" to " <" 2.) Use refactoring as usual
Regards, Marcus. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 10 2006 : 08:35:22 AM
|
*experiments* if you want to be clever about it, then use the following regular expression search and replace. I have done a couple of basic tests in VC6 and it seems to work correctly:
find = \\([^ ]\\)< replace with = \\1 <
this should only insert the space before < if there is no space there already |
zen is the art of being at one with the two'ness |
|
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Oct 10 2006 : 10:55:20 AM
|
Yeah, but it might still conflict with the << operator.
Regards, Marcus. |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 10 2006 : 2:46:42 PM
|
I have just tried it here and it was "safe" on the line:
T operator<<(const Array<T>&);
simply inserting two spaces. I do agree though, any form of search and replace can have unexpected side effects.
for some reason VC6 disables the "Find next" button on the find and replace dialog when doing a replace only on the selected code, so that removes the one really safe method, to use the dialog to step through the code considering each change before making it *sigh* |
zen is the art of being at one with the two'ness |
|
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Oct 11 2006 : 02:23:09 AM
|
Yes, here are some side effects: T operator <<(const Array<T>&);
cerr << "Error!" << endl; is converted to
T operator < <(const Array <T>&);
cerr < < "Error!" < < endl;
And, yes, search and replace sometimes sucks...
Regards, Marcus.
|
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Oct 11 2006 : 12:52:17 PM
|
*oops* a small tweak to the regular expression fixes this specific problem. however a "trial and error" approach is not brilliant:
find = \\([^ <]\\)< replace with = \\1 < |
zen is the art of being at one with the two'ness |
|
|
khb
Tomato Guru
Germany
337 Posts |
Posted - Oct 12 2006 : 02:03:34 AM
|
Much better now! Works at least for my problem.
Regards, Marcus. |
|
|
|
Topic |
|