welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
welder::caster_oracle Concept Reference

The one bindability fact a backend must provide: can it natively convert a type without welder registering it? More...

#include <welder/concepts.hpp>

Concept definition

template<class B>
concept caster_oracle = requires {
{ B::template has_native_caster<detail::any_type> } -> std::convertible_to<bool>;
}
The one bindability fact a backend must provide: can it natively convert a type without welder regist...
Definition concepts.hpp:86

Detailed Description

The one bindability fact a backend must provide: can it natively convert a type without welder registering it?

has_native_caster<T> is true for a native scalar/string/STL type, or one the user gave a bespoke backend converter; false means T is a program-defined class/enum the backend can only handle once welder has registered it (so welder then requires T to be welded).

This concept is a shape guard, not a per-type correctness guarantee: it only checks that B exposes the has_native_caster member template and that it yields something bool-convertible, so a backend that forgot it fails here with a clear "not a `caster_oracle`" instead of a deep error inside bindable(). A concept cannot quantify over every T, so we probe with a single arbitrary type — welder::detail::any_type. Any complete type would do; the value it answers is never inspected.

Template Parameters
Bthe rod type.

Definition at line 86 of file concepts.hpp.