Local functions infer attributes?

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 30 00:48:59 PDT 2014


On Tuesday, 30 September 2014 at 07:18:20 UTC, deadalnix wrote:
> On Tuesday, 30 September 2014 at 07:10:08 UTC, Manu via 
> Digitalmars-d wrote:
>> I have actually thought of that ;) ... but I tend to think 
>> that only D
>> users present on this forum are likely to make sense of that 
>> code, and
>> why.
>
> You can probably wrap this in a nice library solution with an 
> explicit name.

Hmm, I see your point... otherwise maybe user facing code survive 
using a string?

struct S_impl(alias T)
{
   void f(ParameterTypeTuple!T p)
   {
   }
}

template S(string decl)
{
   mixin("alias S = S_impl!((" ~ decl ~ ") {});");
}

S!"ref int x, int y" s;


More information about the Digitalmars-d mailing list