November 07, 2013 Re: Limiting template functions to template instantiations of a struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Marco Leise | On Thursday, 7 November 2013 at 15:46:53 UTC, Marco Leise wrote:
> Am Wed, 06 Nov 2013 14:22:13 +0100
> schrieb "simendsjo" <simendsjo@gmail.com>:
>
>> template isFoo(T) {
>> static if(is(T:Foo!U, int U))
>> enum isFoo = true;
>> else
>> enum isFoo = false;
>> }
>
> enum isFoo(T) = is(T:Foo!U, int U);
>
> correct ?
I haven't tried 2.064 yet, but that should be correct. I'll be able to shave away a whole lot of "useless" lines because of this. And the strange thing is that I didn't even know about this enhancement before reading the changelog.
|
November 07, 2013 Re: Limiting template functions to template instantiations of a struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On 11/07/2013 12:07 AM, H. S. Teoh wrote:
> // This is possibly the single nastiest bit of syntax in all of D:
> static if (is(func X == __parameters)) {
> // Quick, without looking at the docs: what does X refer
> // to?
Nothing.
|
Copyright © 1999-2021 by the D Language Foundation