Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 1 and Version 2 of CompositePattern

Show
Ignore:
Author:
aarti_pl (IP: 213.134.176.198)
Timestamp:
05/26/07 17:57:18 (14 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CompositePattern

    v1 v2  
    3939 
    4040    void remove(GraphicsOperation c) { 
    41         GraphicsOperation[] result; 
    42         foreach (child; children) { 
    43             if (child == c) continue; 
    44             result~=child; 
     41        for(uint i=0; i<children.length; i++) { 
     42            if (children[i] == c) { 
     43                children = children[0..i] ~ children[i+1..$]; 
     44                break; 
     45            } 
    4546        } 
    46         children = result; 
    4747    } 
    4848}