Why is there no combination of popFront and front to pop? (aka Python `next`)

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 16 17:11:29 PST 2016


Sorry, this is the rest of the program: :)

struct S {
     int i;
     static size_t copyCount;

     this(this) {
         ++copyCount;
         if (!(copyCount % 2)) {
             throw new Exception("Failed to copy S");
         }
     }
}

auto next(Range)(ref Range a){
      auto b = a.front;
      a.popFront();
      return b;
}

Ali



More information about the Digitalmars-d-learn mailing list