MCPcopy Create free account
hub / github.com/davisking/dlib / init_instance

Method init_instance

dlib/external/pybind11/include/pybind11/pybind11.h:1920–1927  ·  view source on GitHub ↗

Performs instance initialization including constructing a holder and registering the known instance. Should be called as soon as the `type` value_ptr is set for an instance. Takes an optional pointer to an existing holder to use; if not specified and the instance is `.owned`, a new holder will be constructed to manage the value pointer.

Source from the content-addressed store, hash-verified

1918 /// an optional pointer to an existing holder to use; if not specified and the instance is
1919 /// `.owned`, a new holder will be constructed to manage the value pointer.
1920 static void init_instance(detail::instance *inst, const void *holder_ptr) {
1921 auto v_h = inst->get_value_and_holder(detail::get_type_info(typeid(type)));
1922 if (!v_h.instance_registered()) {
1923 register_instance(inst, v_h.value_ptr(), v_h.type);
1924 v_h.set_instance_registered();
1925 }
1926 init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr<type>());
1927 }
1928
1929 /// Deallocates an instance; via holder, if constructed; otherwise via operator delete.
1930 static void dealloc(detail::value_and_holder &v_h) {

Callers 3

dispatcherMethod · 0.80
constructFunction · 0.80
castMethod · 0.80

Calls 4

register_instanceFunction · 0.85
get_value_and_holderMethod · 0.80
instance_registeredMethod · 0.80

Tested by

no test coverage detected