MCPcopy Create free account
hub / github.com/pybind/pybind11 / add_class_method

Function add_class_method

include/pybind11/pybind11.h:1951–1956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1949}
1950
1951inline void add_class_method(object &cls, const char *name_, const cpp_function &cf) {
1952 cls.attr(cf.name()) = cf;
1953 if (std::strcmp(name_, "__eq__") == 0 && !cls.attr("__dict__").contains("__hash__")) {
1954 cls.attr("__hash__") = none();
1955 }
1956}
1957
1958/// Type trait to rebind a member function pointer's class to `Derived`, preserving all
1959/// cv/ref/noexcept qualifiers. The primary template has no `type` member, providing SFINAE

Callers 1

class_Class · 0.85

Calls 4

noneClass · 0.85
attrMethod · 0.80
nameMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected