1 #include <pybind11/pybind11.h>
2 #include <pybind11/stl.h>
11 #ifndef BINDER_PYBIND11_TYPE_CASTER
12 #define BINDER_PYBIND11_TYPE_CASTER
13 PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)
14 PYBIND11_DECLARE_HOLDER_TYPE(T, T*)
15 PYBIND11_MAKE_OPAQUE(std::shared_ptr<void>)
21 using std::runtime_error::runtime_error;
23 const char*
what()
const throw()
override
25 pybind11::gil_scoped_acquire gil;
26 pybind11::function overload =
27 pybind11::get_overload(
static_cast<const std::runtime_error*
>(
this),
"what");
30 auto o = overload.operator()<pybind11::return_value_policy::reference>();
31 if (pybind11::detail::cast_is_temporary_value_reference<const char*>::value)
34 #if (PYBIND11_MAJOR_VERSION == 2 && PYBIND11_MINOR_VERSION <= 4)
35 static pybind11::detail::overload_caster_t<const char*> caster;
37 static pybind11::detail::override_caster_t<const char*> caster;
39 return pybind11::detail::cast_ref<const char*>(std::move(o), caster);
42 return pybind11::detail::cast_safe<const char*>(std::move(o));
44 return runtime_error::what();
54 cl(M(
"std"),
"runtime_error",
"");
55 cl.def(pybind11::init<const std::string&>(), pybind11::arg(
"__arg"));
57 cl.def(pybind11::init<const char*>(), pybind11::arg(
""));
62 pybind11::init([](std::runtime_error
const& o) {
return new std::runtime_error(o); }));
65 (
class std::runtime_error & (std::runtime_error::*)(
const class std::runtime_error&)) &
66 std::runtime_error::operator=,
67 "C++: std::runtime_error::operator=(const class std::runtime_error "
68 "&) --> class std::runtime_error &",
69 pybind11::return_value_policy::automatic, pybind11::arg(
""));
71 "what", (
const char* (std::runtime_error::*)()
const) & std::runtime_error::what,
72 "C++: std::runtime_error::what() const --> const char *",
73 pybind11::return_value_policy::automatic);