-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathReflection_01.txt
More file actions
28 lines (22 loc) · 826 Bytes
/
Copy pathReflection_01.txt
File metadata and controls
28 lines (22 loc) · 826 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
// =====================================================================================
// Reflection_01.txt
// =====================================================================================
#include <meta>
#include <print>
#include <type_traits>
#include <cassert>
int main()
{
std::println("Start 1:");
constexpr auto r = ^^int;
typename[:r:] x = 123; // same as: int x = 123;
typename[: ^^char :] c = '*'; // same as: char c = '*';
static_assert(std::same_as<decltype(x), int>);
static_assert(std::same_as<decltype(c), char>);
assert(x == 123);
assert(c == '*');
std::println("Done.");
}
// =====================================================================================
// End-of-File
// =====================================================================================