[Issue 16744] New: We should have a TypeOf template so that typeof can be used with templates like staticMap

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Nov 23 13:56:01 PST 2016


https://issues.dlang.org/show_bug.cgi?id=16744

          Issue ID: 16744
           Summary: We should have a TypeOf template so that typeof can be
                    used with templates like staticMap
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: issues.dlang at jmdavisProg.com

Unfortunately, there is no way to do the compile-time equivalent of a lambda
when dealing with templates. So, you can't use do something like

staticMap!(a => typeof(a), args)

or whatever the syntax would be if we had it. So, we need a helper template to
do the same thing if we want to use typeof with something like staticMap. e.g.

staticMap!(TypeOf, args)

It seems to me that it makes sense to add such a helper to Phobos rather than
requiring that everyone do it themselves when they need it.

--


More information about the Digitalmars-d-bugs mailing list