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

Class MyException3

tests/test_exceptions.cpp:45–58  ·  view source on GitHub ↗

A type that is not derived from std::exception (and is thus unknown)

Source from the content-addressed store, hash-verified

43
44// A type that is not derived from std::exception (and is thus unknown)
45class MyException3 {
46public:
47 explicit MyException3(const char *m) : message{m} {}
48 virtual const char *what() const noexcept { return message.c_str(); }
49 // Rule of 5 BEGIN: to preempt compiler warnings.
50 MyException3(const MyException3 &) = default;
51 MyException3(MyException3 &&) = default;
52 MyException3 &operator=(const MyException3 &) = default;
53 MyException3 &operator=(MyException3 &&) = default;
54 virtual ~MyException3() = default;
55 // Rule of 5 END.
56private:
57 std::string message = "";
58};
59
60// A type that should be translated to MyException
61// and delegated to its exception translator

Callers 1

TEST_SUBMODULEFunction · 0.85

Calls

no outgoing calls

Tested by 1

TEST_SUBMODULEFunction · 0.68