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

Backend-agnostic selection layer: the reflection predicates and selectors that decide what participates in a binding — which constructors, methods, operators, data members, namespace entities and base classes are eligible, and what their parameter names/types are. More...

#include <array>
#include <cstddef>
#include <meta>
#include <string_view>
#include <type_traits>
#include <vector>
#include <welder/diag.hpp>
#include <welder/reflect.hpp>
Include dependency graph for bind_traits.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  welder::detail::keep_alive_pair
 A keep_alive lifetime dependency: a (nurse, patient) index pair. More...
struct  welder::detail::field_access< Mem >
 Splice-based accessors for data member Mem — the pointer-to-member-free route the rods bind a protected field through. More...

Namespaces

namespace  welder
namespace  welder::detail
 The stored forms of the annotation vocabulary.

Typedefs

using welder::detail::overload_selector
 The signature of an overload-set selector specialization: the representative overload, the language, and the entity the group binds into.

Functions

template<std::meta::info Fn>
consteval auto welder::detail::param_types ()
 A function's parameter types, as a static array of reflections.
template<std::meta::info Fn>
consteval auto welder::detail::param_names ()
 A function's parameter names, in order.
template<std::meta::info Fn>
consteval auto welder::detail::keep_alive_pairs ()
 The keep_alive dependencies declared on Fn, in declaration order.
template<std::meta::info Fn>
consteval bool welder::detail::all_params_named ()
 Whether every parameter of Fn carries an identifier.
consteval bool welder::detail::is_bindable_constructor (std::meta::info c)
 A non-default, non-copy/move public constructor a backend should expose.
consteval bool welder::detail::is_method_candidate (std::meta::info f)
 The shape of a bindable method: a plain non-private member function.
consteval bool welder::detail::is_operator_candidate (std::meta::info f)
 The shape of a bindable member operator.
template<class Resolution>
consteval bool welder::detail::member_access_admitted (std::meta::info mem, lang L, std::meta::info bound_into)
 Is mem's access level admitted for binding under Resolution?
consteval bool welder::detail::is_unary_operator (std::meta::info f)
 Whether a member operator is unary (0 parameters) vs binary (1 parameter).
template<class T>
consteval auto welder::detail::aggregate_fields ()
 The fields an aggregate is initialized from: its non-static data members in declaration order (all public, by the aggregate rules).
template<class T, lang L, class Resolution>
consteval bool welder::detail::aggregate_initializable ()
 Whether to synthesize an aggregate field constructor for T (language L, resolution Resolution).
consteval bool welder::detail::is_bindable_kind (std::meta::info mem)
 The member kinds welder can expose from a namespace.
consteval bool welder::detail::entity_bound (std::meta::info mem, lang L, policy_kind pol)
 Whether a leaf entity binds: a welded candidate that also resolves as bound.
consteval bool welder::detail::namespace_has_bound (std::meta::info ns, lang L)
 Whether ns holds anything that would bind, directly or nested.
consteval bool welder::detail::namespace_has_bindable (std::meta::info ns, lang L)
 The greedy twin of namespace_has_bound: whether ns holds any bindable kind (ignoring the weld marker), directly or nested.
template<class Resolution>
consteval std::vector< std::meta::info > welder::detail::method_overload_set (std::meta::info fn, lang L, std::meta::info bound_into)
 The participating method overloads sharing fn's name and static-ness, from the class where fn is declared, in declaration order.
template<class Resolution>
consteval std::vector< std::meta::info > welder::detail::operator_overload_set (std::meta::info fn, lang L, std::meta::info bound_into)
 The participating operator overloads sharing fn's target slot (same operator and arity — hence the same special-method name), from fn's declaring class.
template<class Resolution>
consteval std::vector< std::meta::info > welder::detail::function_overload_set (std::meta::info fn, lang L, std::meta::info bound_into)
 The participating free-function overloads sharing fn's name, from fn's declaring namespace, in declaration order.
template<overload_selector Select, std::meta::info Fn, lang L, std::meta::info BoundInto>
consteval auto welder::detail::overload_group ()
 Select's overload set for Fn as a fixed-size, splice-ready static array.
template<overload_selector Select>
consteval bool welder::detail::is_overload_leader (std::meta::info fn, lang L, std::meta::info bound_into)
 Whether fn is the first (declaration order) member of its Select overload set — the single visit on which the carriage emits the whole group.
template<class Resolution, std::meta::info Fn, lang L>
consteval auto welder::detail::manual_function_group ()
 The semi-manual (weld_function<Fn>) group: Fn first — the user's named entity resolves the group's target name — then Fn's participating siblings.
template<class Resolution, std::meta::info Type, lang L, policy_kind Pol>
consteval auto welder::detail::ctor_group ()
 The participating constructors of Type under policy Pol: every bindable-shape constructor (see is_bindable_constructor) the resolution admits, in declaration order.
template<class Resolution, std::meta::info Type, lang L>
consteval bool welder::detail::default_ctor_admitted ()
 Whether the resolution admits Type's DEFAULT constructor.
consteval void welder::detail::collect_native_bases (std::meta::info type, lang L, std::vector< std::meta::info > &out)
 Collect the native bases of type for L: its nearest welded ancestors.
template<std::meta::info Type, lang L>
consteval auto welder::detail::native_base_types ()
 The native bases of Type for L as a static array of type reflections.

Detailed Description

Backend-agnostic selection layer: the reflection predicates and selectors that decide what participates in a binding — which constructors, methods, operators, data members, namespace entities and base classes are eligible, and what their parameter names/types are.

It answers "what", never "how": no backend API appears here, so every backend (pybind11, nanobind, sol2) shares this vocabulary and only supplies the emission primitives.

Note
Like <welder/reflect.hpp>, this depends on the welder vocabulary (lang, policy_kind, …) but does NOT include <welder/annotations.hpp>: provide the vocabulary first (#include <welder/vocabulary.hpp>), then this.

Definition in file bind_traits.hpp.