Re: template C++ mailing lists
Re: template C++ mailing lists
- Subject: Re: template C++ mailing lists
- From: "Wesley Smith" <email@hidden>
- Date: Thu, 22 Feb 2007 12:52:18 -0800
As an example, there is the well known Factoriol template class that
does actually compute the factorial of a number at compile time. Most
of the examples I've seen that do this kind of trick are numerical or
grammatical in nature like template expression trees. I'm still
learning the subtleties of C++ templates w/r/t what can be done in the
preprocessor. This isn't really the place for a discussion on it, but
oh how I wish C++ compilers could do compile-time string processing
like hashing a string into an enum.
wes
On 2/22/07, David A Rowland <email@hidden> wrote:
At 9:21 PM +0100 2/22/07, Stefan Werner wrote:
>On Feb 22, 2007, at 8:06 PM, Thomas Engelmeier wrote:
>
>>>Also, when dealing with C++ and templates: Build/Preprocss is your
>>>best friend!
>>
>>What have templates to do with the preprocessor?
>>They were partially invented to get rid of dirty C macro tricks....
>
>Yes, and templates too get expanded by the preprocessor. So if you
>want to see the same code that the compiler sees (and in cases,
>gives you error messages about), is what comes out of the
>preprocessing step.
Using Xcode 2.4.1 when I Build/Preprocess a .cpp file it creates a .i
file, but the templates are not instantiated. Is that what you mean
by "expanded"?
As I understand it, the preprocessor only deals with # commands. The
preprocessor is ignorant of templates, C or C++ syntax or namespaces.
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden