By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,820 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,820 IT Pros & Developers. It's quick & easy.

how to new some class from template

P: n/a
template is this:

template <class Data>
class FastQueue{

public:
FastQueue(int size){ }
}

I declare myQueue;
FastQueue<DInst *> myQueue;
I don't want to initialize it in constructor use myQueue(32)

I need use new to initialize it:

trie:
myQueue = new FastQueue<DInst *>::FastQueue(32)

failed, don't know how to do

Thanks for help!

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
error get is :
no matching function
for call to `FastQueue<DInst*>::FastQueue()'
...../FastQueue.h:52: candidates are:
FastQueue<DInst*>::FastQueue(const FastQueue<DInst*>&)
...../FastQueue.h:63:
FastQueue<Data>::FastQueue(unsigned int) [with Data = DInst*]


"Jianli Shen" <ji****@cc.gatech.edu> wrote in message
news:d2**********@news-int2.gatech.edu...
template is this:

template <class Data>
class FastQueue{

public:
FastQueue(int size){ }
}

I declare myQueue;
FastQueue<DInst *> myQueue;
I don't want to initialize it in constructor use myQueue(32)

I need use new to initialize it:

trie:
myQueue = new FastQueue<DInst *>::FastQueue(32)

failed, don't know how to do

Thanks for help!

Jul 23 '05 #2

P: n/a
Jianli Shen wrote:
error get is :
no matching function
for call to `FastQueue<DInst*>::FastQueue()'
..../FastQueue.h:52: candidates are:
FastQueue<DInst*>::FastQueue(const FastQueue<DInst*>&)
..../FastQueue.h:63:
FastQueue<Data>::FastQueue(unsigned int) [with Data = DInst*]


"Jianli Shen" <ji****@cc.gatech.edu> wrote in message
news:d2**********@news-int2.gatech.edu...
template is this:

template <class Data>
class FastQueue{

public:
FastQueue(int size){ }
}

I declare myQueue;
FastQueue<DInst *> myQueue;
I don't want to initialize it in constructor use myQueue(32)

I need use new to initialize it:

trie:
myQueue = new FastQueue<DInst *>::FastQueue(32)
Drop the '::' and the "constructor name". Do

FastQueue<DInst*> *myQueue = new FastQueue<DInst*>(32);

failed, don't know how to do
First of all your variable has to be a pointer, and second, you the 'new'
expression needs a type, not a "constructor name".

Thanks for help!


V
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.