From ab691f687da3787b44da68e39f91aa8f56ade6e0 Mon Sep 17 00:00:00 2001 From: frysch Date: Fri, 15 Jan 2021 09:14:49 +0100 Subject: [PATCH] map_conversion: copy forced for loop var `p` (incompatible ref type) The underlying pair that is dereferenced from the iterator has always `const` qualified `first` member (key type). Therefore, an unnecessary temporary was created and bounded to the const ref to the pair. This could be also fixed with `for (const auto &p : from_map)`. --- include/chaiscript/dispatchkit/type_conversions.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/chaiscript/dispatchkit/type_conversions.hpp b/include/chaiscript/dispatchkit/type_conversions.hpp index c98cb8cb..5daee88a 100644 --- a/include/chaiscript/dispatchkit/type_conversions.hpp +++ b/include/chaiscript/dispatchkit/type_conversions.hpp @@ -645,7 +645,7 @@ namespace chaiscript const std::map &from_map = detail::Cast_Helper &>::cast(t_bv, nullptr); To map; - for (const std::pair &p : from_map) { + for (const std::pair &p : from_map) { map.insert(std::make_pair(p.first, detail::Cast_Helper::cast(p.second, nullptr))); }