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

Method cast

include/pybind11/cast.h:560–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558 }
559
560 static handle
561 cast(const StringType &src, return_value_policy /* policy */, handle /* parent */) {
562 const char *buffer = reinterpret_cast<const char *>(src.data());
563 auto nbytes = ssize_t(src.size() * sizeof(CharT));
564 handle s = decode_utfN(buffer, nbytes);
565 if (!s) {
566 throw error_already_set();
567 }
568 return s;
569 }
570
571 PYBIND11_TYPE_CASTER(StringType, const_name(PYBIND11_STRING_NAME));
572

Callers

nothing calls this directly

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected