Re: Template Declarations - Why not Template definitions?

2015-07-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 01, 2015 09:29:56 via Digitalmars-d-learn wrote: > On Tuesday, 30 June 2015 at 21:06:58 UTC, WhatMeWorry wrote: > > Bonus question: Isn't a Zero-parameter template declaration > > pretty much worthless? > > Functions in templates get certain attributes inferred > automatically, l

Re: Template Declarations - Why not Template definitions?

2015-07-01 Thread via Digitalmars-d-learn
On Tuesday, 30 June 2015 at 21:06:58 UTC, WhatMeWorry wrote: Bonus question: Isn't a Zero-parameter template declaration pretty much worthless? Functions in templates get certain attributes inferred automatically, like `@nogc`, `pure`, `nothrow`, `@safe`. Some people use them for that purpose

Re: Template Declarations - Why not Template definitions?

2015-06-30 Thread WhatMeWorry via Digitalmars-d-learn
I was reading "D Templates: A Tutorial" by Philippe Sigaud which says: --- quote What is a Template? In the next chapters, you’ll see how to define function, struct and class templates. But before that, I’d like to introduce what a template really is, because this def

Re: Template Declarations - Why not Template definitions?

2015-06-30 Thread anonymous via Digitalmars-d-learn
On Tuesday, 30 June 2015 at 21:06:58 UTC, WhatMeWorry wrote: All the stuff I've read about templates always refers to them as template declarations. So with the following code segment: template codeBlockTemplate(T, U) { T a = 7; U b = 'z'; } codeBlockTemplate!(int, char); // error he

Template Declarations - Why not Template definitions?

2015-06-30 Thread WhatMeWorry via Digitalmars-d-learn
All the stuff I've read about templates always refers to them as template declarations. So with the following code segment: template codeBlockTemplate(T, U) { T a = 7; U b = 'z'; } codeBlockTemplate!(int, char); // error here Microsof's Visual Studio IDE tells me expected, ; found