From 891a61a5e338393ea7bf69b230b0d831db79a459 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Mon, 18 Mar 2019 02:05:55 +0900 Subject: [PATCH] fix: do not move array element without checking --- toml/value.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toml/value.hpp b/toml/value.hpp index 739f676..a7f1f59 100644 --- a/toml/value.hpp +++ b/toml/value.hpp @@ -474,7 +474,7 @@ class value region_info_(std::make_shared(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::value, @@ -486,7 +486,7 @@ class value this->region_info_ = std::make_shared(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; }