| 444 | | |
|---|
| 445 | | /* |
|---|
| 446 | | Implements the range interface primitive $(D put) for built-in |
|---|
| 447 | | arrays. Due to the fact that nonmember functions can be called with |
|---|
| 448 | | the first argument using the dot notation, $(D array.put(e)) is |
|---|
| 449 | | equivalent to $(D put(array, e)). |
|---|
| 450 | | |
|---|
| 451 | | Example: |
|---|
| 452 | | ---- |
|---|
| 453 | | void main() |
|---|
| 454 | | { |
|---|
| 455 | | int[] a = [ 1, 2, 3 ]; |
|---|
| 456 | | int[] b = a; |
|---|
| 457 | | a.put(5); |
|---|
| 458 | | assert(a == [ 2, 3 ]); |
|---|
| 459 | | assert(b == [ 5, 2, 3 ]); |
|---|
| 460 | | } |
|---|
| 461 | | ---- |
|---|
| 462 | | */ |
|---|
| 463 | | alias std.range.put put; |
|---|
| 464 | | //void put(T, E)(ref T[] a, E e) { assert(a.length); a[0] = e; a = a[1 .. $]; } |
|---|
| 465 | | |
|---|
| 466 | 444 | // overlap |
|---|
| 467 | 445 | /* |
|---|
| 468 | 446 | Returns the overlapping portion, if any, of two arrays. Unlike $(D |
|---|
| 469 | 447 | equal), $(D overlap) only compares the pointers in the ranges, not the |
|---|
| 470 | 448 | values referred by them. If $(D r1) and $(D r2) have an overlapping |
|---|
| 471 | 449 | slice, returns that slice. Otherwise, returns the null slice. |
|---|
| 472 | 450 | |
|---|
| 473 | 451 | Example: |
|---|
| 474 | 452 | ---- |
|---|
| 475 | 453 | int[] a = [ 10, 11, 12, 13, 14 ]; |
|---|