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

Class visitor

tests/test_stl.cpp:515–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

513 "visitor::result_type is required by boost::variant in C++11 mode");
514
515 struct visitor {
516 using result_type = const char *;
517
518 result_type operator()(int) { return "int"; }
519 result_type operator()(const std::string &) { return "std::string"; }
520 result_type operator()(double) { return "double"; }
521 result_type operator()(std::nullptr_t) { return "std::nullptr_t"; }
522# if defined(PYBIND11_HAS_VARIANT)
523 result_type operator()(std::monostate) { return "std::monostate"; }
524# endif
525 };
526
527 // test_variant
528 m.def("load_variant", [](const variant<int, std::string, double, std::nullptr_t> &v) {

Callers 2

TEST_SUBMODULEFunction · 0.85
__call__Method · 0.85

Calls

no outgoing calls

Tested by 2

TEST_SUBMODULEFunction · 0.68
__call__Method · 0.68