.. _program_listing_file_include_eigenpy_copyable.hpp: Program Listing for File copyable.hpp ===================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/eigenpy/copyable.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // // Copyright (c) 2016-2023 CNRS INRIA // Copyright (c) 2023 Heriot-Watt University // #ifndef __eigenpy_utils_copyable_hpp__ #define __eigenpy_utils_copyable_hpp__ #include namespace eigenpy { template struct CopyableVisitor : public bp::def_visitor > { template 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 #endif // ifndef __eigenpy_utils_copyable_hpp__