[Issue 8106] func.stringof with default args

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 13 22:33:09 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8106



--- Comment #9 from Walter Bright <bugzilla at digitalmars.com> 2012-06-13 22:35:21 PDT ---
Or better:

PT[1] getDefault(PT[1..2] a) { return a[0]; }

An example:
-----------------
import std.stdio;

template ParameterTypeTuple(alias foo)
{
    static if (is(typeof(foo) P == function))
        alias P ParameterTypeTuple;
    else
        static assert(0, "argument has no parameters");
}

int func(int i, long j = 7) { return 3; }

alias ParameterTypeTuple!func PT;

int bar(PT) { return 4; }

pragma(msg, typeof(bar));
pragma(msg, PT[1]);

PT[1] boo(PT[1..2] a) { return a[0]; }

void main()
{
    writeln(boo());
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list