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

Function add_ostream_redirect

include/pybind11/iostream.h:293–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291
292 \endrst */
293inline class_<detail::OstreamRedirect>
294add_ostream_redirect(module_ m, const std::string &name = "ostream_redirect") {
295 return class_<detail::OstreamRedirect>(std::move(m), name.c_str(), module_local())
296 .def(init<bool, bool>(), arg("stdout") = true, arg("stderr") = true)
297 .def("__enter__", &detail::OstreamRedirect::enter)
298 .def("__exit__", [](detail::OstreamRedirect &self_, const args &) { self_.exit(); });
299}
300
301PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)

Callers 1

TEST_SUBMODULEFunction · 0.85

Calls 4

moveFunction · 0.85
module_localClass · 0.85
exitMethod · 0.80
argClass · 0.70

Tested by 1

TEST_SUBMODULEFunction · 0.68