diff --git a/include/eigenpy/copyable.hpp b/include/eigenpy/copyable.hpp index 4180ccb4e2adedb8adab9c3648e5f3c24340eb6f..2e3ddb7197fa6ebe0a1b1be31ad1e7445a7da6f0 100644 --- a/include/eigenpy/copyable.hpp +++ b/include/eigenpy/copyable.hpp @@ -1,5 +1,6 @@ // -// Copyright (c) 2016-2021 CNRS INRIA +// Copyright (c) 2016-2023 CNRS INRIA +// Copyright (c) 2023 Heriot-Watt University // #ifndef __eigenpy_utils_copyable_hpp__ @@ -18,10 +19,14 @@ struct CopyableVisitor : public bp::def_visitor<CopyableVisitor<C> > { template <class PyClass> void visit(PyClass& cl) const { cl.def("copy", ©, bp::arg("self"), "Returns a copy of *this."); + cl.def("__copy__", ©, bp::arg("self"), "Returns a copy of *this."); + cl.def("__deepcopy__", &deepcopy, bp::args("self", "memo"), + "Returns a deep copy of *this."); } private: static C copy(const C& self) { return C(self); } + static C deepcopy(const C& self, bp::dict) { return C(self); } }; } // namespace eigenpy