Summary: Length attribute for std.typecons.Tuple
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos

--- Comment #0 from 2010-06-24 04:01:13 PDT ---
This little program (that doesn't work with DMD v2.047) shows why a (constant)
length attribute can be quite useful for tuples:

import std.typecons: Tuple;
import std.typetuple: TypeTuple;
template Iota(int start, int stop) { // 2 argument version
    static if (stop <= start)
        alias TypeTuple!() Iota;
        alias TypeTuple!(Iota!(start, stop-1), stop-1) Iota;
void main() {
    alias Tuple!(char, int, int) Unit;
    auto u1 = Unit('x', 1, 2);
    auto u2 = Unit('y', 10, 20);
    foreach (i; Iota!(1, Unit.length))
        u1.field[i] += u2.field[i];

In that program u1.length (and maybe Unit.length too) needs to be 3.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to