| 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 |