diff --git a/parts/header_file/files/elc/_files/numerical_representation/to_string/_body.hpp b/parts/header_file/files/elc/_files/numerical_representation/to_string/_body.hpp index eac40f5d..22faeb24 100644 --- a/parts/header_file/files/elc/_files/numerical_representation/to_string/_body.hpp +++ b/parts/header_file/files/elc/_files/numerical_representation/to_string/_body.hpp @@ -157,9 +157,10 @@ namespace to_string_n{ aret.pre_alloc_before_begin(info_threshold); } if constexpr(is_big_type){ - //大整数类型可以通过分治法来提高效率 - constexpr auto partition_method_threshold=max(type_info); - if(num > partition_method_threshold){ + if(num.is_safe_convert_to()) + return to_string(num.convert_to()); + else{ + //大整数类型可以通过分治法来提高效率 T base{radix}; size_t len=1;//余数部分要补的前导0个数 //计算分割点 @@ -168,11 +169,9 @@ namespace to_string_n{ base *= base; } //算出分割后的高位和低位 - auto [high,low] = divmod(num, base); + auto [high,low] = divmod(move(num),move(base)); return to_string(move(high)) + to_string(move(low)).pad_left(_repres.get_char(0), len); } - else - return to_string(num.convert_to()); } else{ push_and_disable_msvc_warning(4244); diff --git a/parts/header_file/files/elc/_files/string/string_data_t/end_apply_string_data_t.hpp b/parts/header_file/files/elc/_files/string/string_data_t/end_apply_string_data_t.hpp index b5748c56..b52d21c5 100644 --- a/parts/header_file/files/elc/_files/string/string_data_t/end_apply_string_data_t.hpp +++ b/parts/header_file/files/elc/_files/string/string_data_t/end_apply_string_data_t.hpp @@ -90,18 +90,11 @@ struct end_apply_string_data_t final:base_string_data_t,instance_struct< while(type_info == typeid(*_to) && _to->is_unique()){ //合并重复的end_apply_string_data_t以防树状结构过深 const auto p=down_cast(_to.get()); - const auto p_begin=(const char_T*)(p->_m.begin()); - const auto p_size=p->_used_size; - if(_m.size()-_used_size>=p_size) - copy_assign[p_size](note::from(p_begin),note::to(_m.data()+_used_size)); - else{ - const auto size_now=this->get_size(); - const auto size_new=get_next_gold_size_to_resize_for_array(size_now); - _m.insert_with_resize(_used_size,p_size,p_begin,size_new); - } + discard=p->apply_str_to_end(string_view_t(_m.begin(),_used_size)); + _used_size=p->_used_size; _to_size=p->_to_size; - _used_size+=p_size; - _to=p->_to; + _m=move(p->_m); + _to=move(p->_to); } } void self_changed()noexcept{ diff --git a/parts/header_file/files/elc/_files/string/string_data_t/head_apply_string_data_t.hpp b/parts/header_file/files/elc/_files/string/string_data_t/head_apply_string_data_t.hpp index ecb45dd7..1e179f8b 100644 --- a/parts/header_file/files/elc/_files/string/string_data_t/head_apply_string_data_t.hpp +++ b/parts/header_file/files/elc/_files/string/string_data_t/head_apply_string_data_t.hpp @@ -75,20 +75,11 @@ struct head_apply_string_data_t final:base_string_data_t,instance_struct while(type_info == typeid(*_to) && _to->is_unique()){ //合并重复的head_apply_string_data_t以防树状结构过深 const auto p=down_cast(_to.get()); - const auto p_size=p->_used_size; - const auto p_begin=(const char_T*)(p->_m.end())-p_size; - const auto this_begin=_m.end()-_used_size; - const auto pos=_m.size()-_used_size; - if(pos>=p_size) - copy_assign[p_size](note::from(p_begin),note::to(this_begin-p_size)); - else{ - const auto size_now=this->get_size(); - const auto size_new=get_next_gold_size_to_resize_for_array(size_now); - _m.insert_with_forward_resize(pos,p_size,p_begin,size_new); - } + discard=p->apply_str_to_begin(string_view_t{(char_T*)_m.end()-_used_size,_used_size}); + _used_size=p->_used_size; _to_size=p->_to_size; - _used_size+=p_size; - _to=p->_to; + _m=move(p->_m); + _to=move(p->_to); } } void self_changed()noexcept{