Skip to content

Commit b866b5a

Browse files
committed
minor update
1 parent daa7e71 commit b866b5a

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

.marp-talks

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
cppcon2025/cppcon_2025_slides.md
2+
cppcon2025/presentation.md

cppcon2025/cppcon_2025_slides.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,12 @@ error_code deserialize(auto& json_value, T& out) {
491491
simdjson::ondemand::object obj;
492492
auto er = json_value.get_object().get(obj);
493493
if(er) { return er; }
494+
// capture the attributes:
495+
constexpr auto members = std::define_static_array(std::meta::nonstatic_data_members_of(^^T,
496+
std::meta::access_context::unchecked()));
494497
495-
// This [:expand:] happens at COMPILE TIME
496-
// It literally generates code for each member
497-
[:expand(std::meta::nonstatic_data_members_of(^^T)):] >> [&]<auto member>() {
498+
// This for loop happens at COMPILE TIME
499+
template for (constexpr auto member : members) {
498500
// These are compile-time constants
499501
constexpr std::string_view field_name = std::meta::identifier_of(member);
500502
constexpr auto member_type = std::meta::type_of(member);
@@ -512,13 +514,14 @@ error_code deserialize(auto& json_value, T& out) {
512514

513515
---
514516

515-
# The [:expand:] Statement
517+
518+
# The template for Statement
516519

517-
The `[:expand:]` statement is the key:
520+
The `template for` statement is the key:
518521

519522
- It's like a **compile-time for-loop**
520-
- Generates code for each struct member
521-
- By the time your program runs, all reflection has been "expanded" into normal C++ code
523+
- E.g., it generates code for each struct member
524+
- By the time your program runs, all reflection has been *expanded* into normal C++ code
522525

523526
This means:
524527
- **Zero runtime overhead**

cppcon2025/presentation.pdf

-3.85 KB
Binary file not shown.

0 commit comments

Comments
 (0)