[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Correct use of templated class'es inner structs/classes?
From: |
Tomas Ukkonen |
Subject: |
Re: Correct use of templated class'es inner structs/classes? |
Date: |
Fri, 07 May 2004 17:47:04 +0300 |
User-agent: |
Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) |
On Fri, 07 May 2004 07:04:30 -0700, Michiel Salters wrote:
> Tomas Ukkonen <tomas.ukkonen@iki.fi> wrote in message
> news:<pan.2004.05.07.09.54.54.797578@iki.fi>...
>> Code very close to a example below fails to compile
>> because gcc 3.4.0 complains:
>> "error: expected a type got 'Y<T>::particle'"
>> at Y<T>::func()'s iterator declaration.
>
> Indeed. Without knowing T, gcc cannot tell whether particle is
> a member type, a data member, a member function, or a member template.
>
> The solution is (obviously) to tell the compiler:
>
> std::vector<typename Y<T>::particle> list;
Thanks. I managed to get gcc to accept something similar
while waiting for reply. I have never really read how
templates should work according to standard so I wasn't
sure what the correct behaviour of gcc should be.
--
Tomas Ukkonen