help-gplusplus
[Top][All Lists]
Advanced

[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 22:28:58 +0300
User-agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux))

On Fri, 07 May 2004 11:07:49 +0000, Rob Williscroft wrote:

> Tomas Ukkonen wrote in pan.2004.05.07.09.54.54.797578@iki.fi">news:pan.2004.05.07.09.54.54.797578@iki.fi in 
> comp.lang.c++: 
>> EXAMPLE
>> (I actually haven't tried to get this compile).
> Why not ?.

Guess I'm lazy. It was just pseudocode for
illustrating the problem.

>>     std::vector<Y<T>::particle> list;
>       std::vector< typename Y<T>::particle > list;
> 
> However Y (without the <T>) is an injected class name so you should
> be able to do this:
> 
>       std::vector< Y::particle > list;
> 
> However of the compilers I tried on CBuilderX previeiw (EDG based)
> handled it, g++ 3.4 (prereleas) didn't, your version maybe later than 
> mine so try it.


Thanks for help. It seems I started asking for help a bit too
quickly as I managed to get the code working myself. I don't have
time to test the latter solution right now.

>> example.cpp:
<EXAMPLE CODE>
> This should be in a header file.

Yes, but I usually code in a style where I either put templated code to
cpp files as normally and then include it to header file or 
use explicit template instantations.

-- 
Tomas Ukkonen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]