| 554 | |
| 555 | template <typename T> |
| 556 | array_t<T> array_t<T>::copy() const { |
| 557 | array_t<T> result = { |
| 558 | (T*)ARRAY_MALLOC(sizeof(T) * capacity), |
| 559 | count, |
| 560 | capacity |
| 561 | }; |
| 562 | ARRAY_MEMCPY(result.data, data, sizeof(T) * count); |
| 563 | return result; |
| 564 | } |
| 565 | |
| 566 | ////////////////////////////////////// |
| 567 |