Home

Steve: wrote:
> Hi,
>
> With a normal class, I can do the following:
>
> ---
> class Foo;
>
> void func( Foo* param );
>
> class Foo
> {
> //defined here
> };
> ---
>
>
> How do I declare a templated class before the actual definition?
>
> ---
> class WStr; // Does not work, the compiler complains about
> redifinition.

template<class T> class Tmpl;

>
> void func( WStr* param );

If this is a concrete function (with a certain template specialisation
as the argument type), then do

void func( Tmpl<char>* param );

If it does not work for you, maybe you can put the declaration after
the definition of 'Tmpl' class.

>
> template< class T >
> class Tmpl
> {
> //defined here
> T* t;
> };
>
> typedef Tmpl< char > WStr;
> ---

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

previous
next

Re: Pointer vs Reference
Re: How to do python and RESTful
Re: advice about `correct' use of decorator
Re: small design issues with creating views (portions) of a class
Re: C++ Primer ex 8.3
reklama
nieruchomości w chorwacji
wyszukiwarka mp3
florida
bielizna damska
metale kolorowe
tłumaczenia
filmy
Zdrowe odchudzanie
operandz
słownik polsko angielski
kolczyki pawie pióra