comparison dwt/dwthelper/array.d @ 123:63a09873578e

Fixed compile errors
author Jacob Carlborg <doob@me.com>
date Thu, 15 Jan 2009 23:08:54 +0100
parents 2e671fa40eec
children 38807a925e24
comparison
equal deleted inserted replaced
122:2e671fa40eec 123:63a09873578e
24 * element = element to be appended to this list 24 * element = element to be appended to this list
25 * 25 *
26 * Returns: the modified array 26 * Returns: the modified array
27 * 27 *
28 * Throws: AssertException if the length of the array is 0 28 * Throws: AssertException if the length of the array is 0
29 * Throws: AssertException if the element is null
29 */ 30 */
30 T[] add (T) (ref T[] arr, T element) 31 T[] add (T) (ref T[] arr, T element)
31 in 32 in
32 { 33 {
33 assert(arr.length > 0); 34 assert(arr.length > 0);
45 * element = element to be appended to this list 46 * element = element to be appended to this list
46 * 47 *
47 * Returns: the modified array 48 * Returns: the modified array
48 * 49 *
49 * Throws: AssertException if the length of the array is 0 50 * Throws: AssertException if the length of the array is 0
51 * Throws: AssertException if the element is null
50 */ 52 */
51 alias add addElement; 53 alias add addElement;
52 54
53 /** 55 /**
54 * Gets the element at the specified index 56 * Gets the element at the specified index
56 * Params: 58 * Params:
57 * arr = the array to get the element from 59 * arr = the array to get the element from
58 * index = the index of the element to get 60 * index = the index of the element to get
59 * 61 *
60 * Returns: the element at the specified index 62 * Returns: the element at the specified index
61 *
62 * Throws: AssertException if the length of the array is 0
63 * AssertException if the $(D_CODE index) is greater than the length of the array
64 */ 63 */
65 T elementAt (T) (T[] arr, int index) 64 T elementAt (T) (T[] arr, int index)
66 in 65 in
67 { 66 {
68 assert(arr.length > 0); 67 assert(arr.length > 0);
72 { 71 {
73 return arr[index]; 72 return arr[index];
74 } 73 }
75 74
76 /** 75 /**
77 * Gets the element at the specified position in the array 76 * Gets the element at the specified index
78 * 77 *
79 * Params: 78 * Params:
80 * arr = the array to get the element from 79 * arr = the array to get the element from
81 * index = the index of the element to get 80 * index = the index of the element to get
82 * 81 *
83 * Returns: the element at the specified position 82 * Returns: the element at the specified index
84 *
85 * Throws: AssertException if the length of the array is 0
86 * AssertException if the $(D_CODE index) is greater than the length of the array
87 */ 83 */
88 alias elementAt get; 84 alias elementAt get;
89 85
90 /** 86 /**
91 * Returns the number of elements in the specified array. 87 * Returns the number of elements in the specified array.
110 * index = the index of the element to be removed 106 * index = the index of the element to be removed
111 * 107 *
112 * Returns: the element that was removed or $(D_CODE null) 108 * Returns: the element that was removed or $(D_CODE null)
113 * 109 *
114 * Throws: AssertException if the length of the array is 0 110 * Throws: AssertException if the length of the array is 0
115 * AssertException if the $(D_CODE index) argument is 111 * Throws: AssertException if the $(D_CODE index) argument is
116 * negative or not less than the length of this array. 112 * negative or not less than the length of this array.
117 */ 113 */
118 T remove (T) (ref T[] arr, int index) 114 T remove (T) (ref T[] arr, int index)
119 in 115 in
120 { 116 {