~/talk

Using Reflection to Generate C++ Python Bindings

Talkat ACCU 2025 · 2025-04-01..04-04· [c-and-cpp, python]
links:none on file
slides:none on file

Uses C++ Reflection (compiled against the experimental P2996 Clang fork) to auto-generate real Python bindings for C++ libraries with PyBind11, turning per-function and per-class boilerplate into a compile-time loop that binds functions, parameter names, enums and reflection-generated constructors. Examples compile and produce usable modules, noticeably reducing maintenance for large APIs, but the approach struggles with complex ownership semantics and annotation-driven custom behavior, so hand-written PyBind11 wrappers or a different binding strategy remain necessary for advanced cases.

AI-written summary · about

  1. 0:00Reflection-based Python bindings
  2. 1:09P2996 reflection in Clang
  3. 2:33Boilerplate in PIBind 11
  4. 3:39Key reflection operators
  5. 5:07Reflecting namespaces
  6. 6:10Iterating namespace members
  7. 7:35Binding function parameters
  8. 8:39Reflecting and binding classes
  9. 10:08Binding constructors
  10. 11:33Binding member functions
  11. 12:15When reflection is most useful
  12. 13:39Limitations of reflection
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.