Skip to content

Commit

Permalink
support YLT_REFL
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Jul 19, 2024
1 parent c097f75 commit 76c1ee6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 274 deletions.
11 changes: 0 additions & 11 deletions include/ylt/reflection/internal/foreach_user_macro.hpp

This file was deleted.

260 changes: 0 additions & 260 deletions include/ylt/reflection/internal/generate/foreach_user_macro_gen.hpp

This file was deleted.

12 changes: 9 additions & 3 deletions src/reflection/tests/test_reflection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ void test_pt() {
static_assert(y == 4);
CHECK(y == 4);

#if __has_include(<concetps>)
constexpr auto x = get<"x"_ylts>(pt);
static_assert(x == 2);
#endif
}

TEST_CASE("test member value") {
Expand Down Expand Up @@ -115,11 +117,13 @@ TEST_CASE("test member value") {
auto& age1 = get<int>(p, "age");
CHECK(age1 == 6);

#if __has_include(<concetps>)
auto& age2 = get<"age"_ylts>(p);
CHECK(age2 == 6);

auto& var1 = get<"str"_ylts>(p);
CHECK(var1 == "hello reflection");
#endif

test_pt();

Expand Down Expand Up @@ -173,14 +177,16 @@ TEST_CASE("test member value") {
constexpr std::string_view name2 = name_of<simple>(2);
CHECK(name2 == "str");

#if __has_include(<concetps>)
constexpr size_t idx = index_of<simple, "str"_ylts>();
CHECK(idx == 2);

constexpr size_t idx1 = index_of<simple>("str");
CHECK(idx1 == 2);

constexpr size_t idx2 = index_of<simple, "no_such"_ylts>();
CHECK(idx2 == 4);
#endif

constexpr size_t idx1 = index_of<simple>("str");
CHECK(idx1 == 2);

size_t idx3 = index_of<simple>("no_such");
CHECK(idx3 == 4);
Expand Down

0 comments on commit 76c1ee6

Please sign in to comment.