line |
true |
false |
branch |
103
|
0 |
0 |
if (!mem) throw std::bad_alloc(); |
859
|
48 |
0 |
if (str._length) { // can't call append(const CharT*, size_type) because otherwise if &str == this a fuckup would occur |
880
|
0 |
0 |
if (count) { |
961
|
0 |
24 |
if (pos >= _length) { |
962
|
0 |
0 |
if (pos == _length) return append(s, count); |
963
|
0 |
0 |
throw std::out_of_range("basic_string::insert"); |
965
|
0 |
24 |
if (count == 0) return *this; |
1154
|
0 |
0 |
if (capacity <= MAX_SSO_CHARS) { |
1158
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_new_auto"); |
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_new_auto"); |
1182
|
0 |
21 |
if (pos) traits_type::copy(ibuf->start, _str, pos); |
1249
|
0 |
0 |
if (oth._state == State::SSO) _str = _sso + (oth._str - oth._sso); |
1267
|
0 |
0 |
if (_storage.internal->refcnt > 1) { |
1271
|
0 |
0 |
else if (_storage.internal->capacity < capacity) { // could realloc save anything? |
1279
|
0 |
0 |
if (_storage.external->refcnt > 1) { |
1283
|
0 |
0 |
else if (_storage.external->capacity < capacity) { |
1326
|
0 |
0 |
if (capacity < _length) capacity = _length; |
1336
|
0 |
0 |
if (_storage.internal->refcnt > 1) _detach_cow(capacity); |
1337
|
0 |
0 |
else if (_storage.internal->capacity < capacity) _internal_realloc(capacity); // need to grow storage |
1338
|
0 |
0 |
else if (_capacity_internal() < capacity) { // may not to grow storage if str is moved to the beginning |
1347
|
0 |
0 |
if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) { |
|
0 |
0 |
if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) { |
1348
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_internal_realloc"); |
|
0 |
0 |
if (capacity > MAX_SIZE) throw std::length_error("basic_string::_internal_realloc"); |
1363
|
0 |
0 |
if (_storage.external->refcnt > 1) _detach_cow(capacity); |
1364
|
0 |
0 |
else if (_storage.external->capacity < capacity) _external_realloc(capacity); // need to grow storage, switch to INTERNAL/SSO |
1365
|
0 |
0 |
else if (_capacity_external() < capacity) { // may not to grow storage if str is moved to the beginning |
1381
|
0 |
0 |
if (MAX_SSO_CHARS < capacity) { |
1385
|
0 |
0 |
else if (_capacity_sso() < capacity) { |
1399
|
0 |
0 |
if (_storage.internal->refcnt > 1) { |
1403
|
0 |
0 |
else if (newlen > _storage.internal->capacity) { |
1412
|
0 |
0 |
if (_storage.external->refcnt > 1) { |
1416
|
0 |
0 |
else if (newlen > _storage.external->capacity) { |
1428
|
21 |
3 |
if (newlen > MAX_SSO_CHARS) _new_internal_from_sso(newlen, pos, remove_count, insert_count); |
1439
|
0 |
0 |
if (pos) traits_type::copy(_str, old_str, pos); |
1444
|
0 |
0 |
if (remove_count >= insert_count) { |
1452
|
0 |
0 |
if (has_head_space && has_tail_space) { // move what is shorter |
|
0 |
0 |
if (has_head_space && has_tail_space) { // move what is shorter |
1453
|
0 |
0 |
if (pos > _length - pos - remove_count) { // tail is shorter |
1456
|
0 |
0 |
if (pos) traits_type::move(_str - extra_count, _str, pos); |
1460
|
0 |
0 |
else if (has_head_space) { |
1461
|
0 |
0 |
if (pos) traits_type::move(_str - extra_count, _str, pos); |
1464
|
0 |
0 |
else if (has_tail_space) { |
1468
|
0 |
0 |
if (pos) traits_type::move(ptr_start, _str, pos); |
1492
|
0 |
0 |
static void _release_internal (Buffer* buf, dtor_fn dtor) { if (!--buf->refcnt) _free_internal(buf, dtor); } |
1493
|
0 |
0 |
static void _release_external (ExternalShared* ebuf, dtor_fn dtor) { if (!--ebuf->refcnt) _free_external(ebuf, dtor); } |