|
welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
|
The C++-operator → Python special-method ("dunder") map shared by welder's Python backends. More...
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 an operator (member or anchored free), or nullptr if welder does not expose that operator. | |
| consteval const char * | welder::rods::python::reflected_dunder (std::meta::info f) |
| The reflected ("swapped-operand") dunder for a free operator whose anchor type is the right operand — operator*(double, Vec) binds on Vec as __rmul__, so 2.0 * v works from Python exactly as from C++. | |
| consteval bool | welder::rods::python::dunder_uses_not_implemented (std::meta::info f) |
| Whether f's slot participates in Python's NotImplemented protocol — every binary arithmetic / bitwise / shift / comparison dunder (reflected forms included), where a failed operand conversion must return NotImplemented so Python tries the other operand's reflected method, rather than raise TypeError. | |
| consteval const char * | welder::rods::python::cmp_slot_dunder (::welder::detail::cmp_slot s) |
| The dunder each synthesized comparison slot binds under (see the rods' add_comparisons and welder::detail::synthesized_comparison). | |
| template<class T, auto Fns, auto Covered, class Def> | |
| void | welder::rods::python::synthesize_comparisons (Def def) |
| The comparison-synthesis walk shared by both Python backends: for each operator<=> overload in Fns, hand def a (welder::detail::synthesized_comparison function pointer, dunder name) pair per relational slot not already Covered by an explicit operator. | |
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.