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 = pybind11::get_overload(
27 static_cast<const std::runtime_error*>(
this),
"what");
31 overload.operator()<pybind11::return_value_policy::reference>();
32 if (pybind11::detail::cast_is_temporary_value_reference<
36 #if (PYBIND11_MAJOR_VERSION == 2 && PYBIND11_MINOR_VERSION <= 4) 37 static pybind11::detail::overload_caster_t<const char*> caster;
39 static pybind11::detail::override_caster_t<const char*> caster;
41 return pybind11::detail::cast_ref<const char*>(
42 std::move(o), caster);
45 return pybind11::detail::cast_safe<const char*>(std::move(o));
47 return runtime_error::what();
52 std::function<pybind11::module&(std::string
const& namespace_)>& M)
56 std::runtime_error, std::shared_ptr<std::runtime_error>,
58 cl(M(
"std"),
"runtime_error",
"");
59 cl.def(pybind11::init<const std::string&>(), pybind11::arg(
"__arg"));
61 cl.def(pybind11::init<const char*>(), pybind11::arg(
""));
63 cl.def(pybind11::init([](PyCallBack_std_runtime_error
const& o) {
64 return new PyCallBack_std_runtime_error(o);
66 cl.def(pybind11::init([](std::runtime_error
const& o) {
67 return new std::runtime_error(o);
71 (
class std::runtime_error &
72 (std::runtime_error::*)(
const class std::runtime_error&)) &
73 std::runtime_error::operator=,
74 "C++: std::runtime_error::operator=(const class std::runtime_error " 75 "&) --> class std::runtime_error &",
76 pybind11::return_value_policy::automatic, pybind11::arg(
""));
79 (
const char* (std::runtime_error::*)()
const) &
80 std::runtime_error::what,
81 "C++: std::runtime_error::what() const --> const char *",
82 pybind11::return_value_policy::automatic);
void bind_std_stdexcept(std::function< pybind11::module &(std::string const &namespace_)> &M)
const char * what() const override