forked from fabian-jung/tsmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple.cpp
51 lines (34 loc) · 1.47 KB
/
simple.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
#include <concepts>
#include <fmt/core.h>
#include <fmt/ranges.h>
#include <string_view>
#include <tuple>
#include <iostream>
#include <tsmp/reflect.hpp>
struct todo_
{};
struct foo_t
{
const char* baba = "baba";
std::string s = "asdas";
void call() const& { fmt::print("foo::call() const& const was called;\n"); }
void call() && { fmt::print("foo::call() && const was called;\n"); }
void call2() const { fmt::print("foo::call2() const const was called;\n"); }
void call2() { fmt::print("foo::call() && const was called;\n"); }
void call3(int&& i) const { fmt::print("foo::call3({}) was called;\n", i); }
void call4(const int& i) const { fmt::print("foo::call4({}) was called;\n", i); }
void call5(int& i) const { fmt::print("foo::call5({}) was called;\n", i); }
void call6(int const& i) const { fmt::print("foo::call6({}) was called;\n", i); }
void call7(const int i) const { fmt::print("foo::call7({}) was called;\n", i); }
void call8(int* const i) const { fmt::print("foo::call8({}) was called;\n", *i); }
void call9(const int* i) const { fmt::print("foo::call9({}) was called;\n", *i); }
void call9(const int* i) { fmt::print("foo::call9({}) was called;\n", *i); }
};
int main(int, const char**)
{
auto functions = tsmp::reflect<foo_t>::functions();
std::invoke(std::get<0>(functions).ptr, foo_t{});
std::invoke(std::get<1>(functions).ptr, foo_t{});
std::invoke(std::get<2>(functions).ptr, foo_t{});
return 0;
}