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

The one opt-out mark of the opaque-container generator (welder::rods::opaque_containers::rod): welder::rods::python::by_value. More...

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

Go to the source code of this file.

Classes

struct  welder::rods::python::by_value_spec
 The stored form of a by_value mark (a plain tag — it carries no state). More...

Namespaces

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

Functions

consteval bool welder::rods::python::marked_by_value (std::meta::info entity)
 Does entity carry a by_value mark?

Variables

constexpr by_value_spec welder::rods::python::by_value {}
 Opt a data member's container type out of the opaque-container generator — it keeps default by-value (copy) binding.

Detailed Description

The one opt-out mark of the opaque-container generator (welder::rods::opaque_containers::rod): welder::rods::python::by_value.

The generator binds every reference container (std::vector/std::map/ std::unordered_map) a welded type uses by reference (opaque). Attach by_value to a data member to keep its container type bound the default way — by value, copied through the framework's stl caster:

struct [[=welder::weld(welder::lang::py)]] Frame {
std::vector<double> samples; // opaque (by reference)
[[=welder::rods::python::by_value]] std::vector<int> ids; // stays list[int]
};
constexpr by_value_spec by_value
Opt a data member's container type out of the opaque-container generator — it keeps default by-value ...
Definition marks.hpp:34
consteval detail::weld_spec weld(Ls... ls)
Build a weld annotation naming the target languages.
@ py
Python (via the pybind11 and nanobind backends).
Definition lang.hpp:43

Because opaqueness is a per-type, module-wide decision, by_value on any use site of a container type excludes that whole type from the generator — mirroring how the generator's own opt-in is whole-type. It is a generator-only mark: the runtime binding path never reads it (a container is opaque only if a welded alias exists, which the generator omits for a by_value type). Kept in its own light header so a type header can carry the mark without pulling in the generator rod — the same split as bind_flat in <welder/rods/python/trampoline.hpp>.

Definition in file marks.hpp.