Well, the second cup of coffee solved it for me: CoWork co; for(int i=0;i<ICOUNT;i++){ //co & [&, i] { operation(ib[i]); }; // Reference variant co & [&, i] { operationp(&ib[i]); }; // Pointer variant } co.Finish(); Must have 'copy capture' for i, or otherwise the index i will run away before used. Sorry for bothering with such trivial issue. Best regards, Tom
CoWork co; for(int i=0;i<ICOUNT;i++){ //co & [&, i] { operation(ib[i]); }; // Reference variant co & [&, i] { operationp(&ib[i]); }; // Pointer variant } co.Finish();
CoWork co; co & [&] { for(;;) { int i = co.GetNext(); if(i >= ICOUNT) break; operationp(&ib[i]); } }
Report message to a moderator