grouping templates

P

Pascal Baup

Hi, I have a class using templates, and I'd like to know if there is any way
to avoid to write explicitly template <typename T> for every instances. sthg
like

template <typename T>{

class A{
..
}

Foo1( T);
Foo2(T);

etc

}

Thanks guys,

PSL
 
J

Jacques Labuschagne

Pascal said:
Hi, I have a class using templates, and I'd like to know if there is any way
to avoid to write explicitly template <typename T> for every instances. sthg
like

template <typename T>{

class A{
..
}

Foo1( T);
Foo2(T);

etc

}

Sure:

template<typename T> struct grouper{
class A{
};
static void Foo1(T);
static void Foo2(T);
};
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,174
Messages
2,570,940
Members
47,486
Latest member
websterztechnologies01

Latest Threads

Top