welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
operators.hpp File Reference

The C++-operator → Python special-method ("dunder") map shared by welder's Python backends. More...

#include <meta>
#include <welder/bind_traits.hpp>
Include dependency graph for operators.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  welder
namespace  welder::rods
namespace  welder::rods::python

Functions

consteval const char * welder::rods::python::operator_dunder (std::meta::info f)
 The Python special-method ("dunder") name for a member operator, or nullptr if welder does not expose that operator.

Detailed Description

The C++-operator → Python special-method ("dunder") map shared by welder's Python backends.

pybind11 and nanobind expose the same Python object model, so a member operator maps to the same dunder in both (operator+__add__, …). This header holds that one map so neither backend re-derives it — the Python analogue of <welder/rods/lua/metamethods.hpp> and <welder/rods/python/doc_style.hpp>. A backend calls welder::rods::python::operator_dunder from its special_method_name (the map that both gates operator eligibility and names the slot) and its add_operator.

Requires the welder vocabulary first (#include <welder/vocabulary.hpp>), like the rest of the reflection layer.

Definition in file operators.hpp.