Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module main;
- import std.stdio;
- Foo[uint] foo;
- void main()
- {
- add( new Foo(1) );
- add( new Foo(2) );
- add( new Foo(3) );
- add( new Foo(4) );
- writeln("length: ", foo.length);
- foreach_reverse(key, f; foo)
- {
- if(key >= 2 && key <= 3)
- {
- remove(f);
- continue;
- }
- writeln("k: ", key);
- }
- writeln("length: ", foo.length);
- }
- void add(Foo f)
- {
- foo[f.id] = f;
- }
- void remove(Foo f)
- {
- foo.remove(f.id);
- }
- class Foo
- {
- uint id;
- this(uint id)
- {
- this.id = id;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement