Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 21-11-2009
Member
 
Join Date: Jul 2009
Posts: 79
How to create a template of template

I like to abort creating a template class called Tab, which looks like this:
Code:
template < typename T >
class Tab{
protected :
  int t ;
  T *v ;
public :
// etc... 
}
Then I created a class called Vec as:
Code:
class Vec : public Tab <double>
{
//... 
}
This Vec works without problems.

Now I would like to create a class GroupVec like this:
Code:
//in the .hpp 
class GroupVec : public Tab <Vec>
{
...
}
//in the .cpp, the constructor would
  GroupVec::GroupVec(int a, int b)
    :  Table<Vec(a)>(b)
  {
  }
This method does not work. Is it possible to create a template of template?
Reply With Quote
  #2  
Old 21-11-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: How to create a template of template

Quote:
Is it possible to create a template of template?
yes, there is no problem

However this line seems to me suspicious:
Code:
:  Table<Vec(a)>(b)
Can you post the code that created you the problem and also the error message?
Reply With Quote
  #3  
Old 21-11-2009
Member
 
Join Date: Jul 2009
Posts: 79
Re: How to create a template of template

Thank you for your reply. Indeed, I find it weird, but I do not know how to express the idea that I would only have an object of my class GroupVec which is a Tab of b object of class Vec which themselves are large of size a.
Reply With Quote
  #4  
Old 21-11-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: How to create a template of template

Apart from that, you can follow the example of vector (and provide an instance that will be copied to each element) and secondly, you can also ask whether, for a two-dimensional array, your structure is really adapted.

Why, for example, not have been directly Tab <Tab <double>>? You have a special need on the control lines (or columns, it depends)
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to create a template of template"
Thread Thread Starter Forum Replies Last Post
Where can I find bank check template for Microsoft Word or Template aMADeO! MS Office Support 2 28-01-2012 03:50 PM
How to create Template button in Silverlight 2 Tweaker Tips & Tweaks 2 05-08-2010 12:57 AM
How to create a custom template for Visio? Jacques25 Windows Software 5 21-03-2010 01:10 AM
How to Create a Template in Word Maagh Windows Software 3 25-06-2009 09:28 PM
How to create template in outlook 2003 Techguru01 Tips & Tweaks 1 14-02-2009 11:09 AM


All times are GMT +5.5. The time now is 03:44 AM.