[Issue 9886] New: Cannot pass .tupleof directly to a template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 5 12:25:57 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9886
Summary: Cannot pass .tupleof directly to a template
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-04-05 12:25:56 PDT ---
template Templ(T...) { alias Templ = T; }
struct S { int x, y; }
void main()
{
S s;
auto tup = s.tupleof;
auto x = Templ!(tup); // ok
auto y = Templ!(s.tupleof); // ng
}
For a use-case, a recently created 'reverse' function for the Phobos Tuple type
had this implementation:
@property
auto reversed()
{
static if (is(typeof(this) : Tuple!A, A...))
alias RevTypes = Reverse!A;
Tuple!RevTypes result;
auto tup = this.tupleof; // can't call Reverse(this.tupleof) directly
result.tupleof = Reverse!tup;
return result;
}
--
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