mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-14 00:30:06 +00:00
fix: do not move array element without checking
This commit is contained in:
parent
1908f18e95
commit
891a61a5e3
@ -474,7 +474,7 @@ class value
|
||||
region_info_(std::make_shared<region_base>(region_base{}))
|
||||
{
|
||||
array ary; ary.reserve(list.size());
|
||||
for(auto& elem : list) {ary.emplace_back(std::move(elem));}
|
||||
for(const auto& elem : list) {ary.emplace_back(elem);}
|
||||
assigner(this->array_, std::move(ary));
|
||||
}
|
||||
template<typename T, typename std::enable_if<detail::is_container<T>::value,
|
||||
@ -486,7 +486,7 @@ class value
|
||||
this->region_info_ = std::make_shared<region_base>(region_base{});
|
||||
|
||||
array ary; ary.reserve(list.size());
|
||||
for(auto& elem : list) {ary.emplace_back(std::move(elem));}
|
||||
for(const auto& elem : list) {ary.emplace_back(elem);}
|
||||
assigner(this->array_, std::move(ary));
|
||||
return *this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user