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
 VAX 1524: refactoring: template classes
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2047 Posts

Posted - Jun 21 2006 :  1:31:21 PM  Show Profile  Reply with Quote
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?)

feline
Whole Tomato Software

United Kingdom
17027 Posts

Posted - Jun 22 2006 :  4:22:21 PM  Show Profile  Reply with Quote
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.

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

Uniwares
Tomato Guru

Portugal
2047 Posts

Posted - Jun 22 2006 :  5:59:18 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17027 Posts

Posted - Jun 22 2006 :  7:04:25 PM  Show Profile  Reply with Quote
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?

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

Uniwares
Tomato Guru

Portugal
2047 Posts

Posted - Jun 22 2006 :  8:58:31 PM  Show Profile  Reply with Quote
Never seen the "not yet implemented" message.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17027 Posts

Posted - Jun 24 2006 :  09:19:52 AM  Show Profile  Reply with Quote
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.

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

Uniwares
Tomato Guru

Portugal
2047 Posts

Posted - Jul 10 2006 :  8:06:02 PM  Show Profile  Reply with Quote
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
	{
	}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17027 Posts

Posted - Jul 11 2006 :  6:11:48 PM  Show Profile  Reply with Quote
case=1539

one of several template refactoring bugs, hopefully the developers will get to these soon.

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

support
Whole Tomato Software

5566 Posts

Posted - Aug 08 2006 :  01:11:48 AM  Show Profile  Reply with Quote
Cases 1444 and 1445 are fixed in build 1531.

Edited by - support on Aug 08 2006 01:15:53 AM
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Aug 27 2006 :  7:17:44 PM  Show Profile  Reply with Quote
Case 1539 is fixed in build 1533.
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Apr 11 2012 :  12:41:30 AM  Show Profile  Reply with Quote
Build 1903 contains additional fixes for case=1539
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000