473,385 Members | 1,472 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.

A problem about template.

#include <list>

template <class TYPE, class ARG_TYPE = const TYPE &>
class CList
{
private:
typedef std::list<TYPE>::pointer pointer;

};

when I compiled it with g++, it told me that "type 'std::list<TYPE,
std::allocator<_CharT' is not derived from type 'CList<TYPE,
ARG_TYPE>'"

Who can tell me why?

Nov 25 '06 #1
2 1247

an*****@gmail.com wrote:
#include <list>

template <class TYPE, class ARG_TYPE = const TYPE &>
class CList
{
private:
typedef std::list<TYPE>::pointer pointer;

};

when I compiled it with g++, it told me that "type 'std::list<TYPE,
std::allocator<_CharT' is not derived from type 'CList<TYPE,
ARG_TYPE>'"

Who can tell me why?
Dunno, but you could try :

template <class TYPE, class ARG_TYPE = const TYPE &>
class CList
{
private:
typedef typename std::list<TYPE>::pointer pointer;

};

HTH

regards
Andy Little

Nov 25 '06 #2
Thanks.

"kwikius дµÀ£º
Dunno, but you could try :

template <class TYPE, class ARG_TYPE = const TYPE &>
class CList
{
private:
typedef typename std::list<TYPE>::pointer pointer;

};
Nov 25 '06 #3

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

Similar topics

2
by: CoolPint | last post by:
As a self-exercise, I am trying to write a generic Priority Queue, which would store any type and and accept any user-definable "priority" function. After much tinkering, I came up with...
1
by: BekTek | last post by:
I'm still confused about the template partial specialization which is used in many libraries.. due to lack of introduction for beginner.. Could you tell me about that in short? Thanks in...
5
by: Tony Johansson | last post by:
Hello experts! I have two class template below with names Array and CheckedArray. The class template CheckedArray is derived from the class template Array which is the base class This program...
1
by: suzy | last post by:
hi, i have created a aspx page template by creating a template.cs file which inherits from the page class. In this file I override the OnInit event and create a template in the form of a...
3
by: mca | last post by:
Hi everyone, I'm new to asp.net and i have a question about separating the html code from the programming code. i have an unknown numbers of entries in my table. I want to make a hyperlink...
8
by: sagi.perel | last post by:
I have tried to compile the following code on Win & Unix. Doesn't work on either. <----- CODE -----> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <vector> #include...
4
by: StephQ | last post by:
According to: http://www.parashift.com/c++-faq-lite/templates.html#faq-35.4 , if my understanding is correct, in template<typename T> class Foo { friend void func (const Foo<T>& foo); }; ...
17
by: JohnQ | last post by:
Is that I can approximate using my ideal of a language in it. On the flip side, what I dislike most about it is all the flak/protecting-the-golden-calf one gets when using it that way. I think a...
3
by: goodmen | last post by:
I think the boost::concept_check is too complex. Here is my solution about static interface and concept. The static interface can be used as function param. It is just a proxy of the real...
4
by: parag_paul | last post by:
hi All , I am giving the pseudo code about the problem I am talking about . I have a class hiearchy which looks like this. class A; template <class X1, class X2class B : public A{}
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.