This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ templates: precisions


"erwan ancel" <erwan.ancel@free.fr> writes:

> well, this is my problem:
> 
> I would like to make a template class that owns a set of elements that have
> the type of one of the class parameters. And it doesn't compile...
> example:
> 
> #include <set>
> template <class T>
> class A
> {
>     public:
>         A();
>         B();

set_t.cc:7: ISO C++ forbids declaration of `B' with no type

That's the only error I get for your code. Take a 'B()' and it disappears.

>         std::set<T> _list;
> };
> 
> the compiler's output tells that the type T is not defined... Well,
> of

I get no such error message. I tried with gcc 2.95.3, and gcc 3.2.1 .

> course, but it will be defined when the template will be instanciated. So it
> should be possible...
> Does anybody know a solution to my problem?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]