Changeset 1718
- Timestamp:
- 07/04/10 21:40:26 (14 years ago)
- Files:
-
- trunk/phobos/std/algorithm.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/std/algorithm.d
r1714 r1718 194 194 195 195 static if (hasSlicing!(Range)) { 196 196 typeof(this) opSlice(size_t lowerBound, size_t upperBound) { 197 197 return typeof(this)(_input[lowerBound..upperBound]); 198 198 } 199 199 } 200 200 201 201 static if (isForwardRange!Range) 202 202 @property Map save() 203 203 { 204 return this; 204 auto result = this; 205 result._input = result._input.save; 206 return result; 205 207 } 206 208 } 207 209 208 210 unittest 209 211 { 210 212 scope(failure) writeln("Unittest failed at line ", __LINE__); 211 213 int[] arr1 = [ 1, 2, 3, 4 ]; 212 214 int[] arr2 = [ 5, 6 ]; 213 215 auto squares = map!("a * a")(arr1); 214 216 assert(equal(squares, [ 1, 4, 9, 16 ][]));
