Changeset 1711
- Timestamp:
- 07/03/10 13:50:21 (14 years ago)
- Files:
-
- trunk/phobos/std/array.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/std/array.d
r1587 r1711 381 381 void main() 382 382 { 383 383 int[] a = [ 1, 2, 3 ]; 384 384 assert(a.front == 1); 385 385 } 386 386 ---- 387 387 */ 388 388 ref typeof(A.init[0]) back(A)(A a) if (is(typeof(A.init[0])) 389 389 && !isNarrowString!A) 390 390 { 391 enforce(a.length, "Attempting to fetch the back of an empty array");391 assert(a.length, "Attempting to fetch the back of an empty array"); 392 392 return a[$ - 1]; 393 393 } 394 394 395 395 dchar back(A)(A a) 396 396 if (is(typeof(A.init[0])) && isNarrowString!A && a[0].sizeof < 4) 397 397 { 398 398 assert(a.length, "Attempting to fetch the back of an empty array"); 399 399 auto n = a.length; 400 400 const p = a.ptr + n; 401 401 if (n >= 1 && (p[-1] & 0b1100_0000) != 0b1000_0000)
