Template constraints in D
Sean Kelly
sean at invisibleduck.org
Sun Jun 22 08:23:17 PDT 2008
== Quote from Bill Baxter (dnewsgroup at billbaxter.com)'s article
> 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)))
Not as far as I know. This is the first thing I tried, and it gave me a compile
error when the function couldn't be instantiated.
Sean
More information about the Digitalmars-d
mailing list