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