-
Notifications
You must be signed in to change notification settings - Fork 59
/
main.cpp
59 lines (44 loc) · 1.51 KB
/
main.cpp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <UDRefl/UDRefl.hpp>
#include <iostream>
#include <tuple>
using namespace Ubpa;
using namespace Ubpa::UDRefl;
int main() {
Mngr.RegisterType<std::tuple<int, float, double>>();
for (const auto& [name, method] : MethodRange_of<std::tuple<int, float, double>>) {
std::cout << name.GetView() << ": ";
std::cout << "[";
switch (method.methodptr.GetMethodFlag())
{
case MethodFlag::Variable:
std::cout << "Variable";
break;
case MethodFlag::Const:
std::cout << "Const";
break;
case MethodFlag::Static:
std::cout << "Static";
break;
default:
continue;
break;
}
std::cout << "]";
std::cout << " " << method.methodptr.GetResultType().GetName() << "(" ;
for (const auto& param : method.methodptr.GetParamList())
std::cout << param.GetName() << ", ";
std::cout << ")" << std::endl;
}
SharedObject v = Mngr.MakeShared(Type_of<std::tuple<int, float, double>>, TempArgsView{ 3, 2, 1 });
std::cout << v.GetType().GetName() << std::endl;
for (std::size_t i{ 0 }; i < v.tuple_size(); i++)
std::cout << v.tuple_element(i).GetName() << " (" << i << "): " << v.get(i) << std::endl;
for (std::size_t i{ 0 }; i < v.tuple_size(); i++)
v.get(i) = i;
for (std::size_t i{ 0 }; i < v.tuple_size(); i++)
std::cout << v.tuple_element(i).GetName() << " (" << i << "): " << v.get(i) << std::endl;
v.get(Type_of<float>) = 512;
for (std::size_t i{ 0 }; i < v.tuple_size(); i++)
std::cout << v.tuple_element(i).GetName() << " (" << i << "): " << v.get(i) << std::endl;
return 0;
}