473,405 Members | 2,373 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,405 software developers and data experts.

how to new some class from template

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
2 1131
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sebastian Faust | last post by:
Hi, I have 4 questions related to templates. I wanna do something like the following: template<typename T> class Template { public: Template_Test<T>()
1
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me...
0
by: Leslaw Bieniasz | last post by:
Cracow, 16.09.2004 Hi, I have a problem with compiling the following construction involving cross-calls of class template methods, with additional inheritance. I want to have three class...
2
by: pookiebearbottom | last post by:
Just trying to learn some things about templates. Was wondering how boost::tupple really works, but the headers were a bit confusing to me. I know you get do something like the following, just...
5
by: edd | last post by:
Hello all, Please consider: template<typename Tclass my_class; template<class my_class<int> { //... };
7
by: quarup | last post by:
I want to specialize a template function that lives inside a class, but am getting a compile error in VS.net 2003. Here's my code: template <class T> class A { public: template <class U> void...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
4
by: zfareed | last post by:
#include <iostream> #include <fstream> using namespace std; template<class ItemType> class SortedList { private:
2
by: Barry | last post by:
The following code compiles with VC8 but fails to compiles with Comeau online, I locate the standard here: An explicit specialization of any of the following:
6
by: Dan Smithers | last post by:
I want to write my own class derived from the ostream class. I have been getting errors with my templates: First, I get an error writing a nested template. If I leave the function definition...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.