Re: About template!
From: Crosbie Fitch (crosbie_at_cyberspaceengineers.org)
Date: 02/24/04
- Next message: Egbert Nierop \(MVP for IIS\): "Re: Memory leak?"
- Previous message: Snow: "Memory leak?"
- In reply to: Simon Trew: "Re: About template!"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Feb 2004 11:01:52 +0000 (UTC)
"Simon Trew" <ten.egnaro@werts> wrote in message
news:OuKGTAi%23DHA.1804@TK2MSFTNGP12.phx.gbl...
> Hmm, Kim says extern, you say static. Either way , I can't get it to work.
Well, static storage, global linkage, named.
So you can't use a string literal, or a const string (cos it'll be given
internal linkage) - oops.
So your string has to be defined as:
char MyString[]="An external linkage string";
Then your template can be:
template <char* p>
class Fub....
or
template <const char* p>
And you can then go
Fub<MyString> AFub;
>
> I agree with you that you have to wonder why you'd want this on a char*.
> But a more general pointer argument might occasionally be useful to supply
> something along the lines of a "traits class" if, for some reason, the
> usually way of doing a traits class was not possible.
Sure.
- Next message: Egbert Nierop \(MVP for IIS\): "Re: Memory leak?"
- Previous message: Snow: "Memory leak?"
- In reply to: Simon Trew: "Re: About template!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|