www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16744] New: We should have a TypeOf template so that typeof

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 puremagic.com
          Reporter: issues.dlang 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.

--
Nov 23 2016