| 1 |
diff -Naur ./Container.d changes/Container.d |
|---|
| 2 |
--- ./Container.d 2008-10-07 16:08:35.048858178 +0100 |
|---|
| 3 |
+++ changes/Container.d 2008-09-24 11:22:14.820860981 +0100 |
|---|
| 4 |
@@ -32,7 +32,7 @@ |
|---|
| 5 |
|
|---|
| 6 |
***********************************************************************/ |
|---|
| 7 |
|
|---|
| 8 |
- static int defaultInitialBuckets = 31; |
|---|
| 9 |
+ static size_t defaultInitialBuckets = 31; |
|---|
| 10 |
|
|---|
| 11 |
/*********************************************************************** |
|---|
| 12 |
|
|---|
| 13 |
@@ -67,14 +67,14 @@ |
|---|
| 14 |
|
|---|
| 15 |
***********************************************************************/ |
|---|
| 16 |
|
|---|
| 17 |
- static uint hash(K) (K k, uint length) |
|---|
| 18 |
+ static size_t hash(K) (K k, size_t length) |
|---|
| 19 |
{ |
|---|
| 20 |
static if (is(K : int) || is(K : uint) || |
|---|
| 21 |
is(K : long) || is(K : ulong) || |
|---|
| 22 |
is(K : short) || is(K : ushort) || |
|---|
| 23 |
is(K : byte) || is(K : ubyte) || |
|---|
| 24 |
is(K : char) || is(K : wchar) || is (K : dchar)) |
|---|
| 25 |
- return cast(uint) (k % length); |
|---|
| 26 |
+ return cast(size_t) (k % length); |
|---|
| 27 |
else |
|---|
| 28 |
return (typeid(K).getHash(&k) & 0x7FFFFFFF) % length; |
|---|
| 29 |
} |
|---|
| 30 |
@@ -104,7 +104,7 @@ |
|---|
| 31 |
|
|---|
| 32 |
***************************************************************/ |
|---|
| 33 |
|
|---|
| 34 |
- T*[] allocate (uint count) |
|---|
| 35 |
+ T*[] allocate (size_t count) |
|---|
| 36 |
{ |
|---|
| 37 |
return new T*[count]; |
|---|
| 38 |
} |
|---|
| 39 |
@@ -191,7 +191,7 @@ |
|---|
| 40 |
|
|---|
| 41 |
***************************************************************/ |
|---|
| 42 |
|
|---|
| 43 |
- T*[] allocate (uint count) |
|---|
| 44 |
+ T*[] allocate (size_t count) |
|---|
| 45 |
{ |
|---|
| 46 |
return (cast(T**) calloc(count, (T*).sizeof)) [0 .. count]; |
|---|
| 47 |
} |
|---|
| 48 |
@@ -322,7 +322,7 @@ |
|---|
| 49 |
|
|---|
| 50 |
***************************************************************/ |
|---|
| 51 |
|
|---|
| 52 |
- T*[] allocate (uint count) |
|---|
| 53 |
+ T*[] allocate (size_t count) |
|---|
| 54 |
{ |
|---|
| 55 |
return (cast(T**) calloc(count, (T*).sizeof)) [0 .. count]; |
|---|
| 56 |
} |
|---|
| 57 |
diff -Naur ./HashMap.d changes/HashMap.d |
|---|
| 58 |
--- ./HashMap.d 2008-10-07 16:08:35.044857948 +0100 |
|---|
| 59 |
+++ changes/HashMap.d 2008-10-05 12:43:22.000859886 +0100 |
|---|
| 60 |
@@ -41,9 +41,9 @@ |
|---|
| 61 |
bool removeKey (K key) |
|---|
| 62 |
bool take (ref V element) |
|---|
| 63 |
bool take (K key, ref V element) |
|---|
| 64 |
- uint remove (V element, bool all) |
|---|
| 65 |
- uint remove (IContainer!(V) e, bool all) |
|---|
| 66 |
- uint replace (V oldElement, V newElement, bool all) |
|---|
| 67 |
+ size_t remove (V element, bool all) |
|---|
| 68 |
+ size_t remove (IContainer!(V) e, bool all) |
|---|
| 69 |
+ size_t replace (V oldElement, V newElement, bool all) |
|---|
| 70 |
bool replacePair (K key, V oldElement, V newElement) |
|---|
| 71 |
|
|---|
| 72 |
bool add (K key, V element) |
|---|
| 73 |
@@ -51,15 +51,15 @@ |
|---|
| 74 |
V opIndex (K key) |
|---|
| 75 |
V* opIn_r (K key) |
|---|
| 76 |
|
|---|
| 77 |
- uint size () |
|---|
| 78 |
+ size_t size () |
|---|
| 79 |
bool isEmpty () |
|---|
| 80 |
V[] toArray (V[] dst) |
|---|
| 81 |
HashMap dup () |
|---|
| 82 |
HashMap clear () |
|---|
| 83 |
HashMap reset () |
|---|
| 84 |
- uint buckets () |
|---|
| 85 |
+ size_t buckets () |
|---|
| 86 |
float threshold () |
|---|
| 87 |
- void buckets (uint cap) |
|---|
| 88 |
+ void buckets (size_t cap) |
|---|
| 89 |
void threshold (float desired) |
|---|
| 90 |
Allocator allocator() |
|---|
| 91 |
--- |
|---|
| 92 |
@@ -82,7 +82,7 @@ |
|---|
| 93 |
private Ref table[]; |
|---|
| 94 |
|
|---|
| 95 |
// number of elements contained |
|---|
| 96 |
- private uint count; |
|---|
| 97 |
+ private size_t count; |
|---|
| 98 |
|
|---|
| 99 |
// the threshold load factor |
|---|
| 100 |
private float loadFactor; |
|---|
| 101 |
@@ -91,7 +91,7 @@ |
|---|
| 102 |
private Alloc heap; |
|---|
| 103 |
|
|---|
| 104 |
// mutation tag updates on each change |
|---|
| 105 |
- private uint mutation; |
|---|
| 106 |
+ private size_t mutation; |
|---|
| 107 |
|
|---|
| 108 |
/*********************************************************************** |
|---|
| 109 |
|
|---|
| 110 |
@@ -169,7 +169,7 @@ |
|---|
| 111 |
|
|---|
| 112 |
***********************************************************************/ |
|---|
| 113 |
|
|---|
| 114 |
- final uint size () |
|---|
| 115 |
+ final size_t size () |
|---|
| 116 |
{ |
|---|
| 117 |
return count; |
|---|
| 118 |
} |
|---|
| 119 |
@@ -526,9 +526,9 @@ |
|---|
| 120 |
|
|---|
| 121 |
************************************************************************/ |
|---|
| 122 |
|
|---|
| 123 |
- final uint remove (IContainer!(V) e, bool all = false) |
|---|
| 124 |
+ final size_t remove (IContainer!(V) e, bool all = false) |
|---|
| 125 |
{ |
|---|
| 126 |
- int i = count; |
|---|
| 127 |
+ auto i = count; |
|---|
| 128 |
foreach (value; e) |
|---|
| 129 |
remove (value, all); |
|---|
| 130 |
return i - count; |
|---|
| 131 |
@@ -543,7 +543,7 @@ |
|---|
| 132 |
|
|---|
| 133 |
************************************************************************/ |
|---|
| 134 |
|
|---|
| 135 |
- final uint remove (V element, bool all = false) |
|---|
| 136 |
+ final size_t remove (V element, bool all = false) |
|---|
| 137 |
{ |
|---|
| 138 |
auto i = count; |
|---|
| 139 |
|
|---|
| 140 |
@@ -592,9 +592,9 @@ |
|---|
| 141 |
|
|---|
| 142 |
************************************************************************/ |
|---|
| 143 |
|
|---|
| 144 |
- final uint replace (V oldElement, V newElement, bool all = false) |
|---|
| 145 |
+ final size_t replace (V oldElement, V newElement, bool all = false) |
|---|
| 146 |
{ |
|---|
| 147 |
- uint i; |
|---|
| 148 |
+ size_t i; |
|---|
| 149 |
|
|---|
| 150 |
if (count && oldElement != newElement) |
|---|
| 151 |
foreach (node; table) |
|---|
| 152 |
@@ -649,7 +649,7 @@ |
|---|
| 153 |
|
|---|
| 154 |
***********************************************************************/ |
|---|
| 155 |
|
|---|
| 156 |
- final uint buckets () |
|---|
| 157 |
+ final size_t buckets () |
|---|
| 158 |
{ |
|---|
| 159 |
return table ? table.length : 0; |
|---|
| 160 |
} |
|---|
| 161 |
@@ -665,7 +665,7 @@ |
|---|
| 162 |
|
|---|
| 163 |
***********************************************************************/ |
|---|
| 164 |
|
|---|
| 165 |
- final void buckets (uint cap) |
|---|
| 166 |
+ final void buckets (size_t cap) |
|---|
| 167 |
{ |
|---|
| 168 |
if (cap < Container.defaultInitialBuckets) |
|---|
| 169 |
cap = Container.defaultInitialBuckets; |
|---|
| 170 |
@@ -683,7 +683,7 @@ |
|---|
| 171 |
|
|---|
| 172 |
***********************************************************************/ |
|---|
| 173 |
|
|---|
| 174 |
- final void buckets (uint cap, float threshold) |
|---|
| 175 |
+ final void buckets (size_t cap, float threshold) |
|---|
| 176 |
{ |
|---|
| 177 |
loadFactor = threshold; |
|---|
| 178 |
buckets (cast(int)(cap / threshold) + 1); |
|---|
| 179 |
@@ -799,9 +799,9 @@ |
|---|
| 180 |
|
|---|
| 181 |
***********************************************************************/ |
|---|
| 182 |
|
|---|
| 183 |
- private uint instances (V element) |
|---|
| 184 |
+ private size_t instances (V element) |
|---|
| 185 |
{ |
|---|
| 186 |
- uint c = 0; |
|---|
| 187 |
+ size_t c = 0; |
|---|
| 188 |
foreach (node; table) |
|---|
| 189 |
if (node) |
|---|
| 190 |
c += node.count (element); |
|---|
| 191 |
@@ -830,7 +830,7 @@ |
|---|
| 192 |
|
|---|
| 193 |
***********************************************************************/ |
|---|
| 194 |
|
|---|
| 195 |
- private void resize (uint newCap) |
|---|
| 196 |
+ private void resize (size_t newCap) |
|---|
| 197 |
{ |
|---|
| 198 |
// Stdout.formatln ("resize {}", newCap); |
|---|
| 199 |
auto newtab = heap.allocate (newCap); |
|---|
| 200 |
@@ -955,12 +955,12 @@ |
|---|
| 201 |
|
|---|
| 202 |
private struct Iterator |
|---|
| 203 |
{ |
|---|
| 204 |
- uint row; |
|---|
| 205 |
+ size_t row; |
|---|
| 206 |
Ref cell, |
|---|
| 207 |
prior; |
|---|
| 208 |
Ref[] table; |
|---|
| 209 |
HashMap owner; |
|---|
| 210 |
- uint mutation; |
|---|
| 211 |
+ size_t mutation; |
|---|
| 212 |
|
|---|
| 213 |
/*************************************************************** |
|---|
| 214 |
|
|---|
| 215 |
diff -Naur ./HashSet.d changes/HashSet.d |
|---|
| 216 |
--- ./HashSet.d 2008-10-07 16:08:35.004857322 +0100 |
|---|
| 217 |
+++ changes/HashSet.d 2008-10-05 12:43:21.996858817 +0100 |
|---|
| 218 |
@@ -34,18 +34,18 @@ |
|---|
| 219 |
bool contains (V element) |
|---|
| 220 |
bool take (ref V element) |
|---|
| 221 |
bool remove (V element) |
|---|
| 222 |
- uint remove (IContainer!(V) e) |
|---|
| 223 |
+ size_t remove (IContainer!(V) e) |
|---|
| 224 |
bool replace (V oldElement, V newElement) |
|---|
| 225 |
|
|---|
| 226 |
- uint size () |
|---|
| 227 |
+ size_t size () |
|---|
| 228 |
bool isEmpty () |
|---|
| 229 |
V[] toArray (V[] dst) |
|---|
| 230 |
HashSet dup () |
|---|
| 231 |
HashSet clear () |
|---|
| 232 |
HashSet reset () |
|---|
| 233 |
|
|---|
| 234 |
- uint buckets () |
|---|
| 235 |
- void buckets (uint cap) |
|---|
| 236 |
+ size_t buckets () |
|---|
| 237 |
+ void buckets (size_t cap) |
|---|
| 238 |
float threshold () |
|---|
| 239 |
void threshold (float desired) |
|---|
| 240 |
--- |
|---|
| 241 |
@@ -68,7 +68,7 @@ |
|---|
| 242 |
private Ref table[]; |
|---|
| 243 |
|
|---|
| 244 |
// number of elements contained |
|---|
| 245 |
- private uint count; |
|---|
| 246 |
+ private size_t count; |
|---|
| 247 |
|
|---|
| 248 |
// the threshold load factor |
|---|
| 249 |
private float loadFactor; |
|---|
| 250 |
@@ -77,7 +77,7 @@ |
|---|
| 251 |
private Alloc heap; |
|---|
| 252 |
|
|---|
| 253 |
// mutation tag updates on each change |
|---|
| 254 |
- private uint mutation; |
|---|
| 255 |
+ private size_t mutation; |
|---|
| 256 |
|
|---|
| 257 |
/*********************************************************************** |
|---|
| 258 |
|
|---|
| 259 |
@@ -145,7 +145,7 @@ |
|---|
| 260 |
|
|---|
| 261 |
***********************************************************************/ |
|---|
| 262 |
|
|---|
| 263 |
- final uint size () |
|---|
| 264 |
+ final size_t size () |
|---|
| 265 |
{ |
|---|
| 266 |
return count; |
|---|
| 267 |
} |
|---|
| 268 |
@@ -231,7 +231,7 @@ |
|---|
| 269 |
|
|---|
| 270 |
***********************************************************************/ |
|---|
| 271 |
|
|---|
| 272 |
- final uint remove (V element, bool all) |
|---|
| 273 |
+ final size_t remove (V element, bool all) |
|---|
| 274 |
{ |
|---|
| 275 |
return remove(element) ? 1 : 0; |
|---|
| 276 |
} |
|---|
| 277 |
@@ -287,7 +287,7 @@ |
|---|
| 278 |
|
|---|
| 279 |
***********************************************************************/ |
|---|
| 280 |
|
|---|
| 281 |
- final uint replace (V oldElement, V newElement, bool all) |
|---|
| 282 |
+ final size_t replace (V oldElement, V newElement, bool all) |
|---|
| 283 |
{ |
|---|
| 284 |
return replace (oldElement, newElement) ? 1 : 0; |
|---|
| 285 |
} |
|---|
| 286 |
@@ -351,9 +351,9 @@ |
|---|
| 287 |
|
|---|
| 288 |
************************************************************************/ |
|---|
| 289 |
|
|---|
| 290 |
- public uint remove (IContainer!(V) e) |
|---|
| 291 |
+ public size_t remove (IContainer!(V) e) |
|---|
| 292 |
{ |
|---|
| 293 |
- uint c; |
|---|
| 294 |
+ size_t c; |
|---|
| 295 |
foreach (value; e) |
|---|
| 296 |
if (remove (value)) |
|---|
| 297 |
++c; |
|---|
| 298 |
@@ -400,7 +400,7 @@ |
|---|
| 299 |
|
|---|
| 300 |
***********************************************************************/ |
|---|
| 301 |
|
|---|
| 302 |
- final uint buckets () |
|---|
| 303 |
+ final size_t buckets () |
|---|
| 304 |
{ |
|---|
| 305 |
return table ? table.length : 0; |
|---|
| 306 |
} |
|---|
| 307 |
@@ -413,7 +413,7 @@ |
|---|
| 308 |
|
|---|
| 309 |
***********************************************************************/ |
|---|
| 310 |
|
|---|
| 311 |
- final void buckets (uint cap) |
|---|
| 312 |
+ final void buckets (size_t cap) |
|---|
| 313 |
{ |
|---|
| 314 |
if (cap < Container.defaultInitialBuckets) |
|---|
| 315 |
cap = Container.defaultInitialBuckets; |
|---|
| 316 |
@@ -548,7 +548,7 @@ |
|---|
| 317 |
|
|---|
| 318 |
***********************************************************************/ |
|---|
| 319 |
|
|---|
| 320 |
- private void resize (uint newCap) |
|---|
| 321 |
+ private void resize (size_t newCap) |
|---|
| 322 |
{ |
|---|
| 323 |
//Stdout.formatln ("resize {}", newCap); |
|---|
| 324 |
auto newtab = heap.allocate (newCap); |
|---|
| 325 |
@@ -579,7 +579,7 @@ |
|---|
| 326 |
|
|---|
| 327 |
***********************************************************************/ |
|---|
| 328 |
|
|---|
| 329 |
- private bool remove (Ref node, uint row) |
|---|
| 330 |
+ private bool remove (Ref node, size_t row) |
|---|
| 331 |
{ |
|---|
| 332 |
auto hd = table[row]; |
|---|
| 333 |
auto trail = hd; |
|---|
| 334 |
@@ -683,12 +683,12 @@ |
|---|
| 335 |
|
|---|
| 336 |
private struct Iterator |
|---|
| 337 |
{ |
|---|
| 338 |
- uint row; |
|---|
| 339 |
+ size_t row; |
|---|
| 340 |
Ref cell, |
|---|
| 341 |
prior; |
|---|
| 342 |
Ref[] table; |
|---|
| 343 |
HashSet owner; |
|---|
| 344 |
- uint mutation; |
|---|
| 345 |
+ size_t mutation; |
|---|
| 346 |
|
|---|
| 347 |
/*************************************************************** |
|---|
| 348 |
|
|---|
| 349 |
diff -Naur ./LinkedList.d changes/LinkedList.d |
|---|
| 350 |
--- ./LinkedList.d 2008-10-07 16:08:35.048858178 +0100 |
|---|
| 351 |
+++ changes/LinkedList.d 2008-10-05 12:43:22.000859886 +0100 |
|---|
| 352 |
@@ -38,32 +38,32 @@ |
|---|
| 353 |
V removeTail () |
|---|
| 354 |
|
|---|
| 355 |
bool contains (V value) |
|---|
| 356 |
- uint first (V value, uint startingIndex = 0) |
|---|
| 357 |
- uint last (V value, uint startingIndex = 0) |
|---|
| 358 |
+ size_t first (V value, size_t startingIndex = 0) |
|---|
| 359 |
+ size_t last (V value, size_t startingIndex = 0) |
|---|
| 360 |
|
|---|
| 361 |
LinkedList add (V value) |
|---|
| 362 |
LinkedList prepend (V value) |
|---|
| 363 |
- uint prepend (IContainer!(V) e) |
|---|
| 364 |
+ size_t prepend (IContainer!(V) e) |
|---|
| 365 |
LinkedList append (V value) |
|---|
| 366 |
- uint append (IContainer!(V) e) |
|---|
| 367 |
- LinkedList addAt (uint index, V value) |
|---|
| 368 |
- uint addAt (uint index, IContainer!(V) e) |
|---|
| 369 |
+ size_t append (IContainer!(V) e) |
|---|
| 370 |
+ LinkedList addAt (size_t index, V value) |
|---|
| 371 |
+ size_t addAt (size_t index, IContainer!(V) e) |
|---|
| 372 |
|
|---|
| 373 |
- V get (uint index) |
|---|
| 374 |
+ V get (size_t index) |
|---|
| 375 |
bool take (ref V v) |
|---|
| 376 |
- uint remove (V value, bool all) |
|---|
| 377 |
- bool removeAt (uint index) |
|---|
| 378 |
- uint removeRange (uint fromIndex, uint toIndex) |
|---|
| 379 |
- uint replace (V oldElement, V newElement, bool all) |
|---|
| 380 |
- bool replaceAt (uint index, V value) |
|---|
| 381 |
+ size_t remove (V value, bool all) |
|---|
| 382 |
+ bool removeAt (size_t index) |
|---|
| 383 |
+ size_t removeRange (size_t fromIndex, size_t toIndex) |
|---|
| 384 |
+ size_t replace (V oldElement, V newElement, bool all) |
|---|
| 385 |
+ bool replaceAt (size_t index, V value) |
|---|
| 386 |
|
|---|
| 387 |
LinkedList clear () |
|---|
| 388 |
LinkedList reset () |
|---|
| 389 |
|
|---|
| 390 |
- LinkedList subset (uint from, uint length = int.max) |
|---|
| 391 |
+ LinkedList subset (size_t from, size_t length = int.max) |
|---|
| 392 |
LinkedList dup () |
|---|
| 393 |
|
|---|
| 394 |
- uint size () |
|---|
| 395 |
+ size_t size () |
|---|
| 396 |
bool isEmpty () |
|---|
| 397 |
V[] toArray (V[] dst) |
|---|
| 398 |
LinkedList sort (Compare!(V) cmp) |
|---|
| 399 |
@@ -85,13 +85,13 @@ |
|---|
| 400 |
private alias Heap!(Type) Alloc; |
|---|
| 401 |
|
|---|
| 402 |
// number of elements contained |
|---|
| 403 |
- private uint count; |
|---|
| 404 |
+ private size_t count; |
|---|
| 405 |
|
|---|
| 406 |
// configured heap manager |
|---|
| 407 |
private Alloc heap; |
|---|
| 408 |
|
|---|
| 409 |
// mutation tag updates on each change |
|---|
| 410 |
- private uint mutation; |
|---|
| 411 |
+ private size_t mutation; |
|---|
| 412 |
|
|---|
| 413 |
// head of the list. Null if empty |
|---|
| 414 |
private Ref list; |
|---|
| 415 |
@@ -173,7 +173,7 @@ |
|---|
| 416 |
|
|---|
| 417 |
***********************************************************************/ |
|---|
| 418 |
|
|---|
| 419 |
- final uint size () |
|---|
| 420 |
+ final size_t size () |
|---|
| 421 |
{ |
|---|
| 422 |
return count; |
|---|
| 423 |
} |
|---|
| 424 |
@@ -232,7 +232,7 @@ |
|---|
| 425 |
|
|---|
| 426 |
***********************************************************************/ |
|---|
| 427 |
|
|---|
| 428 |
- final V get (uint index) |
|---|
| 429 |
+ final V get (size_t index) |
|---|
| 430 |
{ |
|---|
| 431 |
return cellAt(index).value; |
|---|
| 432 |
} |
|---|
| 433 |
@@ -240,13 +240,14 @@ |
|---|
| 434 |
/*********************************************************************** |
|---|
| 435 |
|
|---|
| 436 |
Time complexity: O(n) |
|---|
| 437 |
- |
|---|
| 438 |
+ Returns size_t.max if no element found. |
|---|
| 439 |
+ |
|---|
| 440 |
***********************************************************************/ |
|---|
| 441 |
|
|---|
| 442 |
- final uint first (V value, uint startingIndex = 0) |
|---|
| 443 |
+ final size_t first (V value, size_t startingIndex = 0) |
|---|
| 444 |
{ |
|---|
| 445 |
if (list is null || startingIndex >= count) |
|---|
| 446 |
- return uint.max; |
|---|
| 447 |
+ return size_t.max; |
|---|
| 448 |
|
|---|
| 449 |
if (startingIndex < 0) |
|---|
| 450 |
startingIndex = 0; |
|---|
| 451 |
@@ -258,25 +259,26 @@ |
|---|
| 452 |
if (i >= 0) |
|---|
| 453 |
return i + startingIndex; |
|---|
| 454 |
} |
|---|
| 455 |
- return uint.max; |
|---|
| 456 |
+ return size_t.max; |
|---|
| 457 |
} |
|---|
| 458 |
|
|---|
| 459 |
/*********************************************************************** |
|---|
| 460 |
|
|---|
| 461 |
Time complexity: O(n) |
|---|
| 462 |
- |
|---|
| 463 |
+ Returns size_t.max if no element found. |
|---|
| 464 |
+ |
|---|
| 465 |
***********************************************************************/ |
|---|
| 466 |
|
|---|
| 467 |
- final uint last (V value, uint startingIndex = 0) |
|---|
| 468 |
+ final size_t last (V value, size_t startingIndex = 0) |
|---|
| 469 |
{ |
|---|
| 470 |
if (list is null) |
|---|
| 471 |
- return uint.max; |
|---|
| 472 |
+ return size_t.max; |
|---|
| 473 |
|
|---|
| 474 |
auto i = 0; |
|---|
| 475 |
if (startingIndex >= count) |
|---|
| 476 |
startingIndex = count - 1; |
|---|
| 477 |
|
|---|
| 478 |
- auto index = uint.max; |
|---|
| 479 |
+ auto index = size_t.max; |
|---|
| 480 |
auto p = list; |
|---|
| 481 |
while (i <= startingIndex && p) |
|---|
| 482 |
{ |
|---|
| 483 |
@@ -294,7 +296,7 @@ |
|---|
| 484 |
|
|---|
| 485 |
***********************************************************************/ |
|---|
| 486 |
|
|---|
| 487 |
- final LinkedList subset (uint from, uint length = int.max) |
|---|
| 488 |
+ final LinkedList subset (size_t from, size_t length = int.max) |
|---|
| 489 |
{ |
|---|
| 490 |
Ref newlist = null; |
|---|
| 491 |
|
|---|
| 492 |
@@ -410,7 +412,7 @@ |
|---|
| 493 |
|
|---|
| 494 |
***********************************************************************/ |
|---|
| 495 |
|
|---|
| 496 |
- final uint remove (V value, bool all = false) |
|---|
| 497 |
+ final size_t remove (V value, bool all = false) |
|---|
| 498 |
{ |
|---|
| 499 |
auto c = count; |
|---|
| 500 |
if (c) |
|---|
| 501 |
@@ -453,9 +455,9 @@ |
|---|
| 502 |
|
|---|
| 503 |
***********************************************************************/ |
|---|
| 504 |
|
|---|
| 505 |
- final uint replace (V oldElement, V newElement, bool all = false) |
|---|
| 506 |
+ final size_t replace (V oldElement, V newElement, bool all = false) |
|---|
| 507 |
{ |
|---|
| 508 |
- uint c; |
|---|
| 509 |
+ size_t c; |
|---|
| 510 |
if (count && oldElement != newElement) |
|---|
| 511 |
{ |
|---|
| 512 |
auto p = list.find (oldElement); |
|---|
| 513 |
@@ -566,7 +568,7 @@ |
|---|
| 514 |
|
|---|
| 515 |
***********************************************************************/ |
|---|
| 516 |
|
|---|
| 517 |
- final LinkedList addAt (uint index, V value) |
|---|
| 518 |
+ final LinkedList addAt (size_t index, V value) |
|---|
| 519 |
{ |
|---|
| 520 |
if (index is 0) |
|---|
| 521 |
prepend (value); |
|---|
| 522 |
@@ -584,7 +586,7 @@ |
|---|
| 523 |
|
|---|
| 524 |
***********************************************************************/ |
|---|
| 525 |
|
|---|
| 526 |
- final LinkedList removeAt (uint index) |
|---|
| 527 |
+ final LinkedList removeAt (size_t index) |
|---|
| 528 |
{ |
|---|
| 529 |
if (index is 0) |
|---|
| 530 |
removeHead; |
|---|
| 531 |
@@ -604,7 +606,7 @@ |
|---|
| 532 |
|
|---|
| 533 |
***********************************************************************/ |
|---|
| 534 |
|
|---|
| 535 |
- final LinkedList replaceAt (uint index, V value) |
|---|
| 536 |
+ final LinkedList replaceAt (size_t index, V value) |
|---|
| 537 |
{ |
|---|
| 538 |
cellAt(index).value = value; |
|---|
| 539 |
mutate; |
|---|
| 540 |
@@ -617,7 +619,7 @@ |
|---|
| 541 |
|
|---|
| 542 |
***********************************************************************/ |
|---|
| 543 |
|
|---|
| 544 |
- final uint prepend (IContainer!(V) e) |
|---|
| 545 |
+ final size_t prepend (IContainer!(V) e) |
|---|
| 546 |
{ |
|---|
| 547 |
auto c = count; |
|---|
| 548 |
splice_ (e, null, list); |
|---|
| 549 |
@@ -630,7 +632,7 @@ |
|---|
| 550 |
|
|---|
| 551 |
***********************************************************************/ |
|---|
| 552 |
|
|---|
| 553 |
- final uint append (IContainer!(V) e) |
|---|
| 554 |
+ final size_t append (IContainer!(V) e) |
|---|
| 555 |
{ |
|---|
| 556 |
auto c = count; |
|---|
| 557 |
if (list is null) |
|---|
| 558 |
@@ -646,7 +648,7 @@ |
|---|
| 559 |
|
|---|
| 560 |
***********************************************************************/ |
|---|
| 561 |
|
|---|
| 562 |
- final uint addAt (uint index, IContainer!(V) e) |
|---|
| 563 |
+ final size_t addAt (size_t index, IContainer!(V) e) |
|---|
| 564 |
{ |
|---|
| 565 |
auto c = count; |
|---|
| 566 |
if (index is 0) |
|---|
| 567 |
@@ -665,7 +667,7 @@ |
|---|
| 568 |
|
|---|
| 569 |
***********************************************************************/ |
|---|
| 570 |
|
|---|
| 571 |
- final uint removeRange (uint fromIndex, uint toIndex) |
|---|
| 572 |
+ final size_t removeRange (size_t fromIndex, size_t toIndex) |
|---|
| 573 |
{ |
|---|
| 574 |
auto c = count; |
|---|
| 575 |
if (fromIndex <= toIndex) |
|---|
| 576 |
@@ -754,7 +756,7 @@ |
|---|
| 577 |
|
|---|
| 578 |
***********************************************************************/ |
|---|
| 579 |
|
|---|
| 580 |
- private uint instances (V value) |
|---|
| 581 |
+ private size_t instances (V value) |
|---|
| 582 |
{ |
|---|
| 583 |
if (count is 0) |
|---|
| 584 |
return 0; |
|---|
| 585 |
@@ -786,7 +788,7 @@ |
|---|
| 586 |
|
|---|
| 587 |
***********************************************************************/ |
|---|
| 588 |
|
|---|
| 589 |
- private Ref cellAt (uint index) |
|---|
| 590 |
+ private Ref cellAt (size_t index) |
|---|
| 591 |
{ |
|---|
| 592 |
checkIndex (index); |
|---|
| 593 |
return list.nth (index); |
|---|
| 594 |
@@ -796,7 +798,7 @@ |
|---|
| 595 |
|
|---|
| 596 |
***********************************************************************/ |
|---|
| 597 |
|
|---|
| 598 |
- private void checkIndex (uint index) |
|---|
| 599 |
+ private void checkIndex (size_t index) |
|---|
| 600 |
{ |
|---|
| 601 |
if (index >= count) |
|---|
| 602 |
throw new Exception ("out of range"); |
|---|
| 603 |
@@ -915,7 +917,7 @@ |
|---|
| 604 |
Ref* hook, |
|---|
| 605 |
prior; |
|---|
| 606 |
LinkedList owner; |
|---|
| 607 |
- uint mutation; |
|---|
| 608 |
+ size_t mutation; |
|---|
| 609 |
|
|---|
| 610 |
/*************************************************************** |
|---|
| 611 |
|
|---|
| 612 |
diff -Naur ./model/IContainer.d changes/model/IContainer.d |
|---|
| 613 |
--- ./model/IContainer.d 2008-10-07 16:08:35.328858368 +0100 |
|---|
| 614 |
+++ changes/model/IContainer.d 2008-09-24 11:23:17.572860398 +0100 |
|---|
| 615 |
@@ -22,7 +22,7 @@ |
|---|
| 616 |
|
|---|
| 617 |
interface IContainer (V) |
|---|
| 618 |
{ |
|---|
| 619 |
- uint size (); |
|---|
| 620 |
+ size_t size (); |
|---|
| 621 |
|
|---|
| 622 |
bool isEmpty (); |
|---|
| 623 |
|
|---|
| 624 |
@@ -40,11 +40,11 @@ |
|---|
| 625 |
|
|---|
| 626 |
V[] toArray (V[] dst = null); |
|---|
| 627 |
|
|---|
| 628 |
- uint remove (V element, bool all); |
|---|
| 629 |
+ size_t remove (V element, bool all); |
|---|
| 630 |
|
|---|
| 631 |
int opApply (int delegate(ref V value) dg); |
|---|
| 632 |
|
|---|
| 633 |
- uint replace (V oldElement, V newElement, bool all); |
|---|
| 634 |
+ size_t replace (V oldElement, V newElement, bool all); |
|---|
| 635 |
} |
|---|