welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
welder::detail::field_access< Mem > Struct Template Reference

Splice-based accessors for data member Mem — the pointer-to-member-free route the rods bind a protected field through. More...

#include <welder/bind_traits.hpp>

Public Types

using class_type = typename [:std::meta::parent_of(Mem):]
 The declaring class.
using field_type = typename [:std::meta::type_of(Mem):]
 The field's declared type (const included).

Static Public Member Functions

static const field_typeget (const class_type &c)
 Read the field (a reference, so backends can apply their reference-internal return semantics, matching the pointer-to-member path).
static void set (class_type &c, const field_type &v)
 Write the field (instantiated only for mutable fields).

Detailed Description

template<std::meta::info Mem>
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.

[gcc-16 workaround, isolated here] gcc-16 access-checks a dependent &[:Mem:] on a protected data member ("protected within this context"), although the identical splice passes in a non-dependent context and the dependent &[:Fn:] on a protected member function passes too — under P2996 none of them should be checked (access applies to names; a splice is not a name, and the access decision was already taken by the access_context at query time). std::meta::extract<F C::*>(Mem) trips the same check. The member-*access* splice obj.[:Mem:] does not, so a protected field binds as a property over these two accessors instead of a def_readwrite-style pointer-to-member. Both spellings are standard; fold back to &[:Mem:] when gcc's check is fixed.

The class type is Mem's declaring class, so a flattened base's field reads through the base reference (exactly as a base pointer-to-member would).

Template Parameters
Mema reflection of the (non-static) data member.

Definition at line 242 of file bind_traits.hpp.

Member Typedef Documentation

◆ class_type

template<std::meta::info Mem>
using welder::detail::field_access< Mem >::class_type = typename [:std::meta::parent_of(Mem):]

The declaring class.

Definition at line 244 of file bind_traits.hpp.

◆ field_type

template<std::meta::info Mem>
using welder::detail::field_access< Mem >::field_type = typename [:std::meta::type_of(Mem):]

The field's declared type (const included).

Definition at line 246 of file bind_traits.hpp.

Member Function Documentation

◆ get()

template<std::meta::info Mem>
const field_type & welder::detail::field_access< Mem >::get ( const class_type & c)
inlinestatic

Read the field (a reference, so backends can apply their reference-internal return semantics, matching the pointer-to-member path).

Parameters
cthe object.
Returns
the field.

Definition at line 251 of file bind_traits.hpp.

◆ set()

template<std::meta::info Mem>
void welder::detail::field_access< Mem >::set ( class_type & c,
const field_type & v )
inlinestatic

Write the field (instantiated only for mutable fields).

Parameters
cthe object.
vthe new value.

Definition at line 254 of file bind_traits.hpp.


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