http://d.puremagic.com/issues/show_bug.cgi?id=9674
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from [email protected] 2013-03-09 15:20:21 PST --- A solution that does not require caching front is the following: struct Filter(alias a,R){ private R source; // ... private bool processed = false; void process(){ if(!processed) while(!source.empty && !a(source.front)) source.popFront(); processed = true; } @property auto ref front(){ process(); return source.front; } @property bool empty(){ process(); return source.empty; } void popFront(){ process(); source.popFront(); } } It also fixes the problem of filter not being properly lazy (i.e. currently the function call might loop forever, even if no element is actually requested later.) Of course, this might be slower than the current solution in case the compiler is unable to properly track the 'processed' field value. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
