Macro-free object and field initialization#945
Open
magnesj wants to merge 3 commits into
Open
Conversation
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.
ⓘ 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.