welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
welder::detail::keep_alive_spec Struct Reference

The stored form of a keep_alive annotation: a lifetime dependency between two of a call's entities, addressed by pybind11/nanobind's index convention (0 = the return value, 1 = the first argument — the implicit this for a method — 2 = the second, …). More...

#include <welder/annotations.hpp>

Public Attributes

unsigned nurse = 0
 The keeper whose collection bounds the dependency (e.g.
unsigned patient = 0
 The dependant kept alive until the nurse is collected (e.g.

Detailed Description

The stored form of a keep_alive annotation: a lifetime dependency between two of a call's entities, addressed by pybind11/nanobind's index convention (0 = the return value, 1 = the first argument — the implicit this for a method — 2 = the second, …).

Semantics follow pybind11's keep_alive<Nurse, Patient> verbatim: the patient* is kept alive at least until the nurse is garbage collected. A pure Python-binding concept (both Python frameworks expose it as a call policy); the Lua runtimes have no equivalent, so the Lua rods ignore it. It is repeatable — a call may declare several dependencies. Not language-scoped: every framework that has the concept honors it, the rest ignore it.

Definition at line 371 of file annotations.hpp.

Member Data Documentation

◆ nurse

unsigned welder::detail::keep_alive_spec::nurse = 0

The keeper whose collection bounds the dependency (e.g.

1, the this/container).

Definition at line 372 of file annotations.hpp.

◆ patient

unsigned welder::detail::keep_alive_spec::patient = 0

The dependant kept alive until the nurse is collected (e.g.

2, an appended item).

Definition at line 373 of file annotations.hpp.


The documentation for this struct was generated from the following file: