[Issue 11235] Add analog of TypeTuple that does not auto-expand

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 12 15:46:03 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11235


David Nadlinger <code at klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code at klickverbot.at


--- Comment #7 from David Nadlinger <code at klickverbot.at> 2013-10-12 15:45:59 PDT ---
I wonder whether it is worth adding this as an officially supported kind of
tuple, or if we should encourage making creative use of the current syntax to
keep the complexity low: (untested, just typed it up to illustrate the
principle of nesting templates)

---
template isEqual(T...) {
  template to(U...) {
    static if (T.length == U.length) {
      static if (T.length == 0) {
        enum to = true;
      } else {
        enum to = isSame!(T[0], U[0]) && isEqual!(T[1 .. $]).to!(U[1 .. $])
      }
    } else {
      enum to = false;
    }
  }
}

static assert(isEqual!(1, 2, 3).to!(1, 2, 3));
---

-- 
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