Template Function lsst::utils::python::addSharedPtrEquality¶
Function Documentation¶
-
template<typename
T, typenamePyClass>
voidlsst::utils::python::addSharedPtrEquality(PyClass &cls)¶ Add
__eq__and__ne__methods based on two std::shared_ptr<T> pointing to the same addressExample:
- Template Parameters
T: The type to which the std::shared_ptr points.PyClass: The pybind11 class_ type; this can be automatically deduced.
lsst::afw::table records are considered equal if two
std::shared_ptr<record>point to the same record. This is wrapped as follows forlsst::afw::table::BaseRecord, whereclsis an instance ofpybind11::class_<BaseRecord, std::shared_ptr<BaseRecord>>):utils::addSharedPtrEquality<BaseRecord>(cls);
Note that all record subclasses inherit this behavior without needing to call this function.