Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > template class
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 43661 of 48022
Post > Topic >>

template class

by er <erwann.rogard@[EMAIL PROTECTED] > Mar 4, 2008 at 05:24 AM

Hi all,

template<class P,template<class> class TC> class A{
   typedef TC<P> tc_type;
   /*...*/
};

template<class P1,class P2 > class B{/*...*/};

If I want to use B as a parameter in A, for each P2=p2,  I need

template<class P1>
class B_p2: public B<P1,p2>{
 typedef B<P1,p2> parent_type;
 /* may have to write constructors such as B_p2(...):parent_type(...)
{} */
};

I can use it as:

A<P,B_p2> a_p_t2;

Is there a better way/more generic way than writing a new template
class for each P2?
 




 3 Posts in Topic:
template class
er <erwann.rogard@[EMA  2008-03-04 05:24:48 
Re: template class
gnuyuva <gnuyuva@[EMAI  2008-03-04 07:20:39 
Re: template class
er <erwann.rogard@[EMA  2008-03-04 07:52:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 11:24:29 CDT 2008.