Grokking std.container and Ranges

2010-06-28 Thread Mike Parker
I thought I understood ranges until I actually started trying to use them. Now I'm having difficulties with the new range-based containers. So I've got two issues right now, grokking ranges and understanding the container interfaces. Given an SList, I want to do the following: foreach(obj; li

Re: Grokking std.container and Ranges

2010-06-28 Thread BCS
Hello Mike, I want to do the following: foreach(obj; list) { if(obj.pleaseKillMe) somehow_remove_the_object_from_the_list(); } That isn't legal for normal arrays or AAs. IIRC the docs even say that you can't change what a foreach is iterating over during the foreach. I think you will have to

Re: Grokking std.container and Ranges

2010-06-29 Thread Rory McGuire
On Tue, 29 Jun 2010 07:16:13 +0200, BCS wrote: Hello Mike, I want to do the following: foreach(obj; list) { if(obj.pleaseKillMe) somehow_remove_the_object_from_the_list(); } That isn't legal for normal arrays or AAs. IIRC the docs even say that you can't change what a foreach is iterating

Re: Grokking std.container and Ranges

2010-06-29 Thread Steven Schveighoffer
On Mon, 28 Jun 2010 23:01:42 -0400, Mike Parker wrote: I thought I understood ranges until I actually started trying to use them. Now I'm having difficulties with the new range-based containers. So I've got two issues right now, grokking ranges and understanding the container interfaces.