-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcase_5.h
More file actions
32 lines (25 loc) · 955 Bytes
/
Copy pathcase_5.h
File metadata and controls
32 lines (25 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Created by belov on 14.07.2026.
//
#pragma once
namespace case_5 {
void case_5() {
struct DataInfo;
consteval {
constexpr auto fields = std::array<std::meta::info, 2>{
std::meta::data_member_spec(^^double, {.name="price"}),
std::meta::data_member_spec(^^std::size_t, {.name="size"})
};
std::meta::define_aggregate(^^DataInfo, fields);
}
DataInfo dataInfo{
.price=1.1,
.size=5
};
constexpr auto ctx = std::meta::access_context::current();
static constexpr auto structFields = std::define_static_array(std::meta::nonstatic_data_members_of(^^DataInfo, ctx));
static_assert(std::meta::identifier_of(structFields[0]) != "ad");
static_assert(std::meta::identifier_of(structFields[0]) == "price");
static_assert(std::meta::identifier_of(structFields[1]) == "size");
}
}