Skip to content

Macro-free object and field initialization#945

Open
magnesj wants to merge 3 commits into
devfrom
investigate-macro-alternative
Open

Macro-free object and field initialization#945
magnesj wants to merge 3 commits into
devfrom
investigate-macro-alternative

Conversation

@magnesj
Copy link
Copy Markdown
Owner

@magnesj magnesj commented May 5, 2026

No description provided.

magnesj added 3 commits May 5, 2026 15:10
Introduce initPdmObject(), initField(), and initFieldNoDefault() template
methods on PdmObject as a macro-free alternative to CAF_PDM_InitObject,
CAF_PDM_InitField, and CAF_PDM_InitFieldNoDefault. A new PdmKeyword
non-type template parameter type carries the field keyword at compile
time, enabling the existing XML keyword validation static_asserts to run
without macros. A PdmObjectDerived concept constrains the templates so
misuse produces a clear diagnostic.
Add unit tests covering the new initPdmObject/initField/initFieldNoDefault
template methods, including the AppEnum raw-enum overload, field keyword
registration, UI capability wiring, and object UI name.

Add compile-time benchmark translation units that mirror each existing
benchmark using the macro-free template API, so the per-TU compile cost
of the two APIs can be compared directly. A new bench_heavy_fields pair
(50 classes with mixed field types) amplifies the signal beyond
run-to-run noise. /bigobj is enabled for MSVC because the heavy template
TU exceeds the default COFF section limit.
Add extern template declarations for the 13 most common PdmField<T>
specializations (primitive types, QString, vector/optional/pair
containers) in cafPdmField.h, with matching explicit instantiations
in a new cafPdmField.cpp. Every TU that includes cafPdmField.h now
skips re-instantiating these specializations while still inlining the
hot in-class members.
@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant