Fix list::assign

This commit is contained in:
rexy712 2022-07-22 10:02:32 -07:00
parent eafe6f5a21
commit 9ad75d9f82

View File

@ -323,18 +323,22 @@ namespace rexy{
{ {
auto current = begin(); auto current = begin();
size_type i = 0; size_type i = 0;
if constexpr(std::is_assignable_v<value_type, decltype(*first)>){ if constexpr(std::is_assignable_v<value_type, decltype(*first)>){
for(;i < m_size && first != last;++i){ for(;i < m_size && first != last;++i){
*current++ = *first++; *current++ = *first++;
} }
} if(first == last){
if(first != last){ erase(current, end());
m_size = i;
while(first != last){
current = ++(insert(current, *first++));
} }
m_size = i;
}else{ }else{
erase(current, end()); clear();
current = end();
}
while(first != last){
current = ++(emplace(current, *first++));
} }
} }
template<class T, class Alloc> template<class T, class Alloc>