http://d.puremagic.com/issues/show_bug.cgi?id=9071
--- Comment #5 from [email protected] 2012-11-25 07:30:14 PST --- OK, what you showed me was that indeed, "deque" is not "sliceable" according to the new definition. It does also show that there are some issues in sort's implementation that need to be looked into. However (next section relevant), note that it is perfectly possible to sort your container via a slice of that container: http://dpaste.dzfl.pl/e601b75a I just added "opSlice();", and changed the call to: std.algorithm.sort!("a < b")(de[]); -------- On a side note, regarding your dequeue implementation: You are mixing the notion of container, and range. A container holds stuff. A range gives you an interface to access that stuff. The difference becomes apparent once you start poping stuff. A range is expected to merelly "walk forward", whereas your container will actually discard and destroy its elements: Not the expected behavior. This is especially true in your "save" implementation: Save is just supposed to duplicate the range (the view) itself, but not the elements. In particular, this should always hold (provided non-transisent assignable): Range r = something; auto rr = r.save; r.front = someValue; assert(rr.front == someValue); In your case, your implementation of "save" is what "dup" should be. Your save should probably be implemented as simply "return this"; Do you have a C++ background? It's kind of the same in the sense that you can't sort a container directly, but a pair of that container's iterator. Unless you have a Java background? Anyways, the "standard" fix is usually to just rename your "popFront" functions into "removeFront". -------- Last but not least (since I'm reviewing your implementation), it is usually considered an *error* to access past an empty range/iterator, or to access past the valid bounds of a container. It is usually recommended in that case to error-out (assert) instead. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
