Template constraints in D
Bill Baxter
dnewsgroup at billbaxter.com
Sat Jun 21 17:47:11 PDT 2008
Sean Kelly wrote:
> == Quote from bearophile (bearophileHUGS at lycos.com)'s article
>> Walter Bright:
>>> http://www.digitalmars.com/d/2.0/concepts.html
>> They look nice (but I may use a bigger list of examples to understand how they can be used). What
> can they do that can't be done with the things already present?
>
> Nothing. But it's a very convenient syntactic sugar on top of existing
> techniques, such as:
>
> http://www.digitalmars.com/d/archives/digitalmars/D/Stroustrup_s_talk_on_C_0x_57104.html#N5737
> 9
>
> Walter had even asked me to write an article about this, but I never
> followed through :p
>
> I will say that the __traits(compiles, blah) trick is totally awesome. I
> was trying to do this in D 1.0 the other day and couldn't find a way to
> make it work. Figures it would require D 2.0. *sigh*
DeeGirl's trick works in D 1.x doesn't it?
I.e. a template function + is(typeof(thatTemplateFunction!(T)))
--bb
More information about the Digitalmars-d
mailing list