| 44 | |
| 45 | template <class _CharT, class _Traits, class _Allocator> |
| 46 | void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) { |
| 47 | if (__libcpp_is_constant_evaluated()) |
| 48 | __rep_ = __rep(); |
| 49 | if (__reserve > max_size()) |
| 50 | __throw_length_error(); |
| 51 | pointer __p; |
| 52 | if (__fits_in_sso(__reserve)) { |
| 53 | __set_short_size(__sz); |
| 54 | __p = __get_short_pointer(); |
| 55 | } else { |
| 56 | auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__reserve) + 1); |
| 57 | __p = __allocation.ptr; |
| 58 | __begin_lifetime(__p, __allocation.count); |
| 59 | __set_long_pointer(__p); |
| 60 | __set_long_cap(__allocation.count); |
| 61 | __set_long_size(__sz); |
| 62 | } |
| 63 | traits_type::copy(std::__to_address(__p), __s, __sz); |
| 64 | traits_type::assign(__p[__sz], value_type()); |
| 65 | __annotate_new(__sz); |
| 66 | } |
| 67 | |
| 68 | # define STRING_LEGACY_API(CharT) \ |
| 69 | template _LIBCPP_EXPORTED_FROM_ABI void basic_string<CharT>::__init(const value_type*, size_type, size_type) |
nothing calls this directly
no test coverage detected