| 163 | |
| 164 | template<typename allocator> |
| 165 | inline void basic_string<allocator>::reserve(size_t capacity) { |
| 166 | if (m_first + capacity + 1 <= m_capacity) |
| 167 | return; |
| 168 | |
| 169 | const ptrdiff_t size = m_last - m_first; |
| 170 | |
| 171 | pointer newfirst = (pointer)allocator::static_allocate(capacity + 1); |
| 172 | for (pointer it = m_first, newit = newfirst, end = m_last; it != end; ++it, ++newit) |
| 173 | *newit = *it; |
| 174 | if (m_first != m_buffer) |
| 175 | allocator::static_deallocate(m_first, m_capacity - m_first); |
| 176 | |
| 177 | m_first = newfirst; |
| 178 | m_last = newfirst + size; |
| 179 | m_capacity = m_first + capacity; |
| 180 | } |
| 181 | |
| 182 | template<typename allocator> |
| 183 | inline void basic_string<allocator>::resize(size_t size) { |
no outgoing calls
no test coverage detected