| 260 | void clear() { mCore.clear(); } |
| 261 | |
| 262 | void resize(fl::size new_capacity) { |
| 263 | // Save existing elements |
| 264 | fl::size count = mCore.size(); |
| 265 | fl::size to_save = (count < new_capacity) ? count : new_capacity; |
| 266 | // Use a temporary storage to save elements |
| 267 | vector_inlined<T, (N > 0 ? N : 1)> saved; |
| 268 | saved.resize(to_save); |
| 269 | for (fl::size i = 0; i < to_save; ++i) { |
| 270 | saved[i] = mCore[i]; |
| 271 | } |
| 272 | // Resize storage |
| 273 | mStorage.resize(new_capacity); |
| 274 | mCore.assign(mStorage.data(), new_capacity); |
| 275 | // Re-insert saved elements |
| 276 | for (fl::size i = 0; i < to_save; ++i) { |
| 277 | mCore.push_back(saved[i]); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | /// Equality comparison |
| 282 | bool operator==(const circular_buffer& other) const { |
no test coverage detected