[Issue 12433] Allow forward referencing IFTI types in template argument list

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 6 04:01:10 PDT 2016


greensunny12 at gmail.com changed:

           What    |Removed                     |Added
                 CC|                            |greensunny12 at gmail.com

--- Comment #2 from greensunny12 at gmail.com ---
It's not an "hypothetical example" - it makes real code ugly! :/

Let me add an example from a recent PR in phobos

If we could support the forwarding of argument types, we would only have _one_,
very nice & readable function header:

T[] makeArray(T = Unqual!(ElementType!R), Allocator, R)

Of course we can add another function overload, but it unnecessary bloats!

Unqual!(ElementType!R)[] makeArray(Allocator, R)(auto ref Allocator alloc, R
      import std.range.primitives;
      alias T = Unqual!(ElementType!R);
      return makeArray!(T, Allocator, R)(alloc, range);

T[] makeArray(T, Allocator, R)(auto ref Allocator alloc, R range)      


More information about the Digitalmars-d-bugs mailing list