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

Method cast

include/pybind11/stl.h:533–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

531
532 template <typename T>
533 static handle cast(T &&src, return_value_policy policy, handle parent) {
534 if (!src) {
535 return none().release();
536 }
537 if (!std::is_lvalue_reference<T>::value) {
538 policy = return_value_policy_override<Value>::policy(policy);
539 }
540 // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
541 return value_conv::cast(*std::forward<T>(src), policy, parent);
542 }
543
544 bool load(handle src, bool convert) {
545 if (!src) {

Callers

nothing calls this directly

Calls 3

noneClass · 0.85
releaseMethod · 0.80
castFunction · 0.70

Tested by

no test coverage detected