473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

template with several classes

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
Aug 15 '05 #1
3 1065
Tony Johansson wrote:
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
Aug 15 '05 #2

"Victor Bazarov" <v.********@comAcast.net> skrev i meddelandet
news:vK********************@comcast.com...
Tony Johansson wrote:
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


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
Aug 15 '05 #3

"Tony Johansson" <jo*****************@telia.com> wrote in message
news:mA*********************@newsc.telia.net...
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

Aug 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric | last post by:
Does anyone know if you can specialize a template function for arguments that are pointers to a particular base class and not lose the subclass type? example: template <class E> void...
4
by: Grey Plastic | last post by:
I have several classes that all keep track of static data. However, the manner that they keep track of static data is identical, and so I'm using the template<class Child> class Parent { ... };...
7
by: Leon | last post by:
I'm having a bit of a template-problem, and I was wondering if you guru's know what I'm doing wrong here... I want to create a Vertex class that supports a toPoint() method. Now, in my case...
11
by: Guotao Luan | last post by:
Hello All: I notice that there have been frequent questions being asked about template here so I guess it is okay to post this message here. I just wrote a c++ tempalte tutorial/review, I would...
4
by: kl.vanw | last post by:
I would like to count the nesting level in template classes. How can I make the following work? #include <assert.h> template <class T> class A { public: A() { // what goes here?
35
by: Steven T. Hatton | last post by:
Perhaps I'm just a bit frustrated, and I will soon realize the clear truth of the matter, but right now I have some serious misgivings about the value of investing a lot of time and effort into...
45
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs...
272
by: Peter Olcott | last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a I think that the operator() member function does not work correctly, does anyone else know how to make a template for making two...
4
by: AndrewD | last post by:
Hey C++ folks, I created this today, just for fun. You can make object allocation for any class around 6 times faster, simply by doing the following. class MyClass : public...
2
by: Thomas Witkowski | last post by:
Hello, I have a class with one template parameter. When a second class, also with a template parameter that is forwarded to the first class, is derived from this class, why it is required to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.