SDWest paper "Templates Revisited" now available

Hasan Aljudy hasan.aljudy at gmail.com
Sat Mar 18 00:27:33 PST 2006


Walter Bright wrote:
> www.digitalmars.com/d/templates-revisited.html 
> 
> 

Nice! not that I'm into templates or anything ..

note: somethings are duplicated, for example, this segment:

-------
Partial and explicit specialization work as they do in C++, except that 
there is no notion of a 'primary' template in D. All the templates with 
the same name are examined upon template instantiation, and the one with 
the best fit of arguments to parameters is instantiated.

Specialization

Partial and explicit specialization work as they do in C++, except that 
there is no notion of a 'primary' template. All the templates with the 
same name are examined upon template instantiation, and the one with the 
best fit of arguments to parameters is instantiated.

--------------

and this one:

----------

import std.stdio;
import regex;

void main()
{
     auto exp = &regexMatch!(r"[a-z]*\s*\w*");
     writefln("matches: %s", exp("hello    world"));
}

What follows is a cut-down version of Eric Andertons regex compiler. It 
is just enough to compile the regular expression above, serving to 
illustrate how it is done.

-------------------



More information about the Digitalmars-d-announce mailing list