mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 02:08:09 +08:00
fix: do not move array element without checking
This commit is contained in:
@@ -474,7 +474,7 @@ class value
|
|||||||
region_info_(std::make_shared<region_base>(region_base{}))
|
region_info_(std::make_shared<region_base>(region_base{}))
|
||||||
{
|
{
|
||||||
array ary; ary.reserve(list.size());
|
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));
|
assigner(this->array_, std::move(ary));
|
||||||
}
|
}
|
||||||
template<typename T, typename std::enable_if<detail::is_container<T>::value,
|
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{});
|
this->region_info_ = std::make_shared<region_base>(region_base{});
|
||||||
|
|
||||||
array ary; ary.reserve(list.size());
|
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));
|
assigner(this->array_, std::move(ary));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user