Exchanges the content of the container by the content of rhs, which is another vector object of the same type. Sizes may differ. We use std::swap to do the operation. */
| 536 | We use std::swap to do the operation. |
| 537 | */ |
| 538 | void swap(Prealloced_array &rhs) { |
| 539 | // Just swap pointers if both arrays have done malloc. |
| 540 | if (!using_inline_buffer() && !rhs.using_inline_buffer()) { |
| 541 | std::swap(m_ext.m_alloced_size, rhs.m_ext.m_alloced_size); |
| 542 | std::swap(m_ext.m_alloced_capacity, rhs.m_ext.m_alloced_capacity); |
| 543 | std::swap(m_ext.m_array_ptr, rhs.m_ext.m_array_ptr); |
| 544 | std::swap(m_psi_key, rhs.m_psi_key); |
| 545 | return; |
| 546 | } |
| 547 | std::swap(*this, rhs); |
| 548 | } |
| 549 | |
| 550 | /** |
| 551 | Requests the container to reduce its capacity to fit its size. |
nothing calls this directly
no test coverage detected