| 418 | typename mem_manager |
| 419 | > |
| 420 | void array<T,mem_manager>:: |
| 421 | set_max_size( |
| 422 | size_t max |
| 423 | ) |
| 424 | { |
| 425 | reset(); |
| 426 | array_size = 0; |
| 427 | last_pos = 0; |
| 428 | if (max != 0) |
| 429 | { |
| 430 | // if new max size is different |
| 431 | if (max != max_array_size) |
| 432 | { |
| 433 | if (array_elements) |
| 434 | { |
| 435 | pool.deallocate_array(array_elements); |
| 436 | } |
| 437 | // try to get more memroy |
| 438 | try { array_elements = pool.allocate_array(max); } |
| 439 | catch (...) { array_elements = 0; max_array_size = 0; throw; } |
| 440 | max_array_size = max; |
| 441 | } |
| 442 | |
| 443 | } |
| 444 | // if the array is being made to be zero |
| 445 | else |
| 446 | { |
| 447 | if (array_elements) |
| 448 | pool.deallocate_array(array_elements); |
| 449 | max_array_size = 0; |
| 450 | array_elements = 0; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | // ---------------------------------------------------------------------------------------- |
| 455 |
nothing calls this directly
no test coverage detected