[phobos] phobos commit, revision 1566

dsource.org noreply at dsource.org
Sat May 29 06:44:18 PDT 2010


phobos commit, revision 1566


user: rsinfu

msg:
Fixed bugzilla 3876: std.range.Take back/popBack methods don't work correctly.
Thanks to Philippe Sigaud for the proposed solution.  It was helpful.

The former implementation simply used input.back for Take.back.  It didn't work if input.length was larger than maxAvailable.  For example:
  input = [ 1, 2, 3, 4, 5 ]
  s = take(input, 3)            // [ 1, 2, 3 ]
  s.back == input.back == 5     // wrong!

Take must pop all the excess elements from the input ([4,5] in the above example) to provide correct back element.  This change makes it to do so if input is purely bidirectional.  (random access is used instead if possible.)

- Added Take.opSlice
- Added some enforcement error messages

http://www.dsource.org/projects/phobos/changeset/1566



More information about the phobos mailing list