welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
welder::detail::only_spec Struct Reference

The stored form of an only mark: the complete set of languages a member may bind for — implicitly, not for any other. More...

#include <welder/annotations.hpp>

Public Member Functions

template<class... Ls>
consteval only_spec operator() (lang first, Ls... rest) const
 Name the complete set of languages the member may bind for.

Public Attributes

unsigned mask = 0
 The only languages to bind for; 0 == the (diagnosed) bare form.

Detailed Description

The stored form of an only mark: the complete set of languages a member may bind for — implicitly, not for any other.

The closed-world counterpart of exclude_spec: exclude names languages to hide from (open-ended — a language it doesn't name still binds, including a welder::user_lang minted later), while only names everything that may bind. Under policy::opt_in it also counts as the member's opt-in, so no separate include is needed; an explicit exclude covering a language still beats an only naming it. Repeated only marks union their languages.

Unlike the other marks there is no meaningful bare form — "only, for every language" restricts nothing — so it must be called:

[[=welder::mark::only(welder::lang::py)]] // binds for py, nowhere else
constexpr detail::only_spec only
@ py
Python (via the pybind11 and nanobind backends).
Definition lang.hpp:43

A bare [[=welder::mark::only]] is diagnosed when the member is resolved.

Definition at line 202 of file annotations.hpp.

Member Function Documentation

◆ operator()()

template<class... Ls>
only_spec welder::detail::only_spec::operator() ( lang first,
Ls... rest ) const
inlineconsteval

Name the complete set of languages the member may bind for.

Template Parameters
Lsfurther language enum types (deduced).
Parameters
firstthe first language — at least one is required.
restfurther languages.
Returns
a scoped only_spec.

Definition at line 211 of file annotations.hpp.

References welder::lang_mask().

Member Data Documentation

◆ mask

unsigned welder::detail::only_spec::mask = 0

The only languages to bind for; 0 == the (diagnosed) bare form.

Definition at line 203 of file annotations.hpp.


The documentation for this struct was generated from the following file: