fix: do not move array element without checking

This commit is contained in:
ToruNiina 2019-03-18 02:05:55 +09:00
parent 1908f18e95
commit 891a61a5e3

View File

@ -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;
}