-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathmain.cpp
55 lines (43 loc) · 1.34 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
#include <UDRefl/UDRefl.hpp>
#include <iostream>
#include <variant>
using namespace Ubpa;
using namespace Ubpa::UDRefl;
int main() {
Mngr.RegisterType<std::variant<int, float, double>>();
for (const auto& [name, method] : MethodRange_of<std::variant<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::variant<int, float, double>>, TempArgsView{ 3. });
std::cout << v.GetType().GetName() << std::endl;
std::cout << v.variant_visit_get().GetType().GetName() << std::endl;
std::cout << v.index() << std::endl;
std::cout << v.holds_alternative(Type_of<double>) << std::endl;
std::cout << v.holds_alternative(Type_of<float>) << std::endl;
for (size_t i = 0; i < v.variant_size(); ++i)
std::cout << v.variant_alternative(i).GetName() << std::endl;
}
return 0;
}