[Issue 7657] New: ReturnType fails for simple templated functions
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Mar  6 17:51:57 PST 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=7657
           Summary: ReturnType fails for simple templated functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-03-06 17:51:58 PST ---
import std.algorithm;
import std.traits;
void main()
{
    alias ReturnType!countUntil Type;  // fails
}
Here's the thing: countUntil has a defined return type and it doesn't change
based on its template arguments. So I think the above should work.
I'm doing some metaprogramming and I need to get the return type of a function
so I can wrap it. I can't simply use 'auto' because I'm also wrapping the
return type, e.g.:
template Magic(alias func)
{
    Wrapped!(ReturnType!func) Magic(T...)(T t)
    {
         // ..
    }
}
I think ReturnType could be made to work even though it's a non-instantiated
template (I'm not sure how but maybe there's a way).
-- 
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