| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "StretchableArray.hpp" | ||
| 2 | #include "compat/memory14.hpp" | ||
| 3 | |||
| 4 | 24 | void StretchableArray::reserve(gsl::index i) { | |
| 5 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 21 times.
|
24 | if (i >= size_) { |
| 6 | 3 | auto larger_size = std::max(i, 2 * size_); | |
| 7 | // NOLINTNEXTLINE(*-avoid-c-arrays) | ||
| 8 |
1/2✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
|
3 | auto larger_data = std::make_unique<double[]>(larger_size); |
| 9 |
1/2✓ Branch 16 taken 3 times.
✗ Branch 17 not taken.
|
3 | std::copy(data_.get(), data_.get() + size_, larger_data.get()); |
| 10 | 3 | data_ = std::move(larger_data); | |
| 11 | 3 | size_ = larger_size; | |
| 12 | 3 | } | |
| 13 | 24 | } | |
| 14 |