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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 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: -------