bearophile wrote:
Yigal Chripun:

personally, I think opApply should be removed. it provides "push" style iteration which should be 
provided as a "each" method of the container. the "pull" style of ranges should be used with 
client side looping.<

I don't understand what do you mean. Can you show me how you would like to 
replace the purpose of opApply, maybe with an example?

Bye,
bearophile

auto c = new Container(Type)();
..

1. Container implements iteration, "yields" items in sequence
c.each( (Type obj) { ... } );

2. client code implements iteration, pulls container for items
auto r = c.getRange(); // name isn't important, just the semantics
while (!r.empty) {
   // do stuff with current item
   if (some_external_condition) break;
}

Reply via email to