template with several classes

T

Tony Johansson

Hello experts!

If I have this statement
Stack<Array<Integer> > s;
then Stack and Array is class template but Integer is not.
Is that right?

//Tony
 
V

Victor Bazarov

Tony said:
If I have this statement
Stack<Array<Integer> > s;
then Stack and Array is class template but Integer is not.
Is that right?

Depend on where this statement appears.

V
 
T

Tony Johansson

Victor Bazarov said:
Depend on where this statement appears.

V

Let say in main.
We do not pass any kind of parameter to this Integer class. If this Integer
class is a template then this class must have all parameter set by their
default values.

Right?

//Tony
 
G

Guest

If I have this statement
Stack<Array<Integer> > s;
then Stack and Array is class template but Integer is not.
Is that right?

If Array takes a "template template" parameter, Integer might in fact be a
template:

template<class T>
class Integer
{};

template <template <class> class TC>
class Array
{
TC<char> tc_;

public:

};

template <class T>
class Stack
{
public:
};


int main()
{
Stack<Array<Integer> > s;
s = s;
}

Ali
 

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

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top