diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -1894,6 +1894,25 @@ #endif } +template +void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external( + const value_type* __s, size_type __sz) { + pointer __p; + if (__sz < __min_cap) { + __p = __get_short_pointer(); + __set_short_size(__sz); + } else { + if (__sz > max_size()) + this->__throw_length_error(); + size_t __cap = __recommend(__sz); + __p = __alloc_traits::allocate(__alloc(), __cap + 1); + __set_long_pointer(__p); + __set_long_cap(__cap + 1); + __set_long_size(__sz); + } + traits_type::copy(_VSTD::__to_address(__p), __s, __sz + 1); +} + #ifndef _LIBCPP_CXX03_LANG template @@ -1914,25 +1933,6 @@ #endif } -template -void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external( - const value_type* __s, size_type __sz) { - pointer __p; - if (__sz < __min_cap) { - __p = __get_short_pointer(); - __set_short_size(__sz); - } else { - if (__sz > max_size()) - this->__throw_length_error(); - size_t __cap = __recommend(__sz); - __p = __alloc_traits::allocate(__alloc(), __cap + 1); - __set_long_pointer(__p); - __set_long_cap(__cap + 1); - __set_long_size(__sz); - } - traits_type::copy(_VSTD::__to_address(__p), __s, __sz + 1); -} - template inline basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)