view tests/mini/foreach9.d @ 468:45a67b6f1310

Removed the 'needsstorage' thing from Dsymbol. Arguments are not always given storage when applicable. This is not longer treat specially in this regard. Code for accessing nested variables and contexts rewritten. Probably more. Fairly well tested.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 04 Aug 2008 02:59:34 +0200
parents
children
line wrap: on
line source

module mini.foreach9;
extern(C) int printf(char* str, ...);

struct array2d(T) {
  int test() {
    printf("%p\n", cast(void*) this);
    foreach (x; *this) {
      printf("%p\n", cast(void*) this);
    }
    return true;
  }
  int opApply(int delegate(ref int) dg) {
    int x;
    return dg(x), 0;
  }
}

unittest {
  array2d!(int) test;
  test.test();
  //int i = 0; i /= i;
}

void main() { }