raw pointer getter for function/member/method/variable

This commit is contained in:
BlackMATov
2024-08-09 21:02:04 +07:00
parent ead26278fa
commit 4ddaf7970f
10 changed files with 61 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ namespace
static int arg_unbounded_const_arr(const ivec2 vs[]) { return vs[0].x + vs[0].y + vs[1].x + vs[1].y; }
};
[[maybe_unused]]
bool operator==(const ivec2& l, const ivec2& r) noexcept {
return l.x == r.x && l.y == r.y;
}
@@ -63,6 +64,11 @@ TEST_CASE("meta/meta_states/function") {
CHECK((iadd_f < ilength2_f || ilength2_f < iadd_f));
}
SUBCASE("pointers") {
CHECK(ivec2_type.get_function("iadd").get_pointer().as<decltype(&ivec2::iadd)>() == &ivec2::iadd);
CHECK(ivec2_type.get_function("ilength2").get_pointer().as<decltype(&ivec2::ilength2)>() == &ivec2::ilength2);
}
SUBCASE("iadd") {
const meta::function func = ivec2_type.get_function("iadd");
REQUIRE(func);