Skip to content

Commit 7bddd6a

Browse files
authored
Merge pull request #383 from cmastalli/topic/copyable
Extended copyable visitor
2 parents ab8c362 + f3edc2e commit 7bddd6a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

include/eigenpy/copyable.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//
2-
// Copyright (c) 2016-2021 CNRS INRIA
2+
// Copyright (c) 2016-2023 CNRS INRIA
3+
// Copyright (c) 2023 Heriot-Watt University
34
//
45

56
#ifndef __eigenpy_utils_copyable_hpp__
@@ -18,10 +19,14 @@ struct CopyableVisitor : public bp::def_visitor<CopyableVisitor<C> > {
1819
template <class PyClass>
1920
void visit(PyClass& cl) const {
2021
cl.def("copy", &copy, bp::arg("self"), "Returns a copy of *this.");
22+
cl.def("__copy__", &copy, bp::arg("self"), "Returns a copy of *this.");
23+
cl.def("__deepcopy__", &deepcopy, bp::args("self", "memo"),
24+
"Returns a deep copy of *this.");
2125
}
2226

2327
private:
2428
static C copy(const C& self) { return C(self); }
29+
static C deepcopy(const C& self, bp::dict) { return C(self); }
2530
};
2631
} // namespace eigenpy
2732

0 commit comments

Comments
 (0)