Skip to content

Commit 3af5502

Browse files
committed
Use copy constructor
1 parent a01e65e commit 3af5502

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

core/include/core/container_pybindings.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,7 @@ register_map(py::module_ &scope, std::string name, Args &&...args)
264264
}, py::return_value_policy::reference_internal);
265265

266266
cls.def("copy", [](const M &m) {
267-
auto v = std::unique_ptr<M>(new M());
268-
for (auto it: m)
269-
v->emplace(it.first, it.second);
270-
return v.release();
267+
return std::unique_ptr<M>(new M(m)).release();
271268
});
272269

273270
cls.def("get", [](const M &m, const K &k) {

0 commit comments

Comments
 (0)