From f4902ece170fe7e17f112f2516e58030d788d12d Mon Sep 17 00:00:00 2001 From: Ben Pritchard Date: Sat, 5 Mar 2016 17:36:46 -0500 Subject: [PATCH] Use emplace for casting to map --- include/pybind11/stl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index fca1ab8e4..97ccdbc84 100644 --- a/include/pybind11/stl.h +++ b/include/pybind11/stl.h @@ -72,7 +72,7 @@ template struct map_caster { if (!kconv.load(it.first.ptr(), convert) || !vconv.load(it.second.ptr(), convert)) return false; - value[(Key) kconv] = (Value) vconv; + value.emplace((Key) kconv, (Value) vconv); } return true; }