Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VAX 1524: refactoring: template classes

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
Uniwares Posted - Jun 21 2006 : 1:31:21 PM
All features of refactoring do ignore template class definitions.
This class produces some interesting effects, when using functions like Move Implementation, Document Method, Add similar, change signature, etc...
Try it with this class:

namespace outer { 
  namespace inner {
    template<typename T>
    class test
    {
     public:
      explicit Test(const T& _data) : m_data(_data) { /* move imp. */ };
      virtual ~Test();

      const T& MoveMeToCPP() const { return m_data; }
      virtual T& Data() const = 0;

     private:
       T m_data;
    }
  } 
}

I havent tried yet more complex template classes (geez, what about cascading ones?)
10   L A T E S T    R E P L I E S    (Newest First)
support Posted - Apr 11 2012 : 12:41:30 AM
Build 1903 contains additional fixes for case=1539
support Posted - Aug 27 2006 : 7:17:44 PM
Case 1539 is fixed in build 1533.
support Posted - Aug 08 2006 : 01:11:48 AM
Cases 1444 and 1445 are fixed in build 1531.
feline Posted - Jul 11 2006 : 6:11:48 PM
case=1539

one of several template refactoring bugs, hopefully the developers will get to these soon.
Uniwares Posted - Jul 10 2006 : 8:06:02 PM
Another thing: Create Implementation does not add the template specification to the function.
e.g.:

template <typename T, const std::string& szFilterName>
	class IFilterData
	{
	public:
		const std::string& Name() const;
	};


creates:
const std::string& IFilterData::Name() const
{
}

instead of
	template<typename T, const std::string& szFilterName> 
	const std::string& IFilterData<T, szFilterName>::Name() const
	{
	}
feline Posted - Jun 24 2006 : 09:19:52 AM
how are you triggering add similar member? via the VA menu, the context menu, or the refactoring icon? so far i am only getting "not yet implemented" when i use the VA menu.

using add similar member via the refactoring icon it seems to be working correctly for me, adding both a new member variable and a new member function. moving the new functions body to the cpp file does not work, but this is a problem with Move Implementation to Source File rather than add similar.

what problem are you seeing? perhaps i am not trying the right thing.
Uniwares Posted - Jun 22 2006 : 8:58:31 PM
Never seen the "not yet implemented" message.
feline Posted - Jun 22 2006 : 7:04:25 PM
the function makes sense now you point out the mistake *oops* Move Implementation to Source File problem:

case=1443

document method producing odd results is:

case=1444

change signature breaking the function body is:

case=1445

for add similar member all i get is the message box "not yet implemented". are you getting the same, or some other result?
Uniwares Posted - Jun 22 2006 : 5:59:18 PM
Semicolons... hmm, habit. no reason. not required. happens automatically.

usually its not a problem to have the implementation in the cpp file, at least with vs2005. the problem with your sample is the missing template type for the class:
template<typename T>
const T& test<T>::MoveMeToCPP() const
{
    return m_data;
}


Cascading is meant as (template-)class in (template-)class or struct in class.
class x { potected: class Y { protected: struct {} abc; }; };


Yeah, sometimes there are template classes as sub classes of template classes. Leads to constructs like:
T& class1<T, bool>::class2<N>::class2() ...

Well, not everything thats possible is meant to be beautiful.
feline Posted - Jun 22 2006 : 4:22:21 PM
out of curiosity, is there some reason why you have semi colons on the end of the constructor line?

i am seeing something odd with move implementation to cpp file. when i was last seriously writing template classes, a while ago under UNIX, i had to make all functions inline, since the compiler could not generate the code otherwise.

so i have generated a test C++ console application with VS2005. ignoring the namespaces (for simplicity) i have added this test class to a header file, and in the matching cpp file i have tried:

template<typename T>
const T& test::MoveMeToCPP() const
{
    return m_data;
}


which seeed like the obvious format, but this does not compile. does VS2005 support splitting template classes between the cpp and header file?

longer term, what do you mean by a cascading template class? i have the feeling i am not going to like the answer but i should probably ask.

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