MCPcopy Create free account
hub / github.com/pybind/pybind11 / operator new

Method operator new

tests/test_copy_move.cpp:256–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254
255 private:
256 void *operator new(size_t bytes) {
257 void *ptr = std::malloc(bytes);
258 if (ptr) {
259 return ptr;
260 }
261 throw std::bad_alloc{};
262 }
263 };
264 py::class_<PrivateOpNew>(m, "PrivateOpNew").def_readonly("value", &PrivateOpNew::value);
265 m.def("private_op_new_value", []() { return PrivateOpNew(); });

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected