From c738e20c7963cf799724285f137bcc9bb8ba31e5 Mon Sep 17 00:00:00 2001 From: Alexej Doronin Date: Tue, 17 Dec 2024 21:03:52 +0200 Subject: [PATCH] Update to describe 3.0 --- CMakeLists.txt | 2 +- include/glua/glua.hpp | 2 +- tests/main.cpp | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad15d91..7883b20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ include(CPM.cmake) option(GLUA_TESTS "Build glua tests" OFF) -CPMAddPackage("gh:cyanidle/describe@2.0") +CPMAddPackage("gh:cyanidle/describe@3.0") add_library(glua INTERFACE) target_include_directories(glua INTERFACE include) diff --git a/include/glua/glua.hpp b/include/glua/glua.hpp index b993c04..bd38229 100644 --- a/include/glua/glua.hpp +++ b/include/glua/glua.hpp @@ -198,7 +198,7 @@ int newindex_for(lua_State* L) { desc.for_each([&](auto f){ if constexpr (f.is_field) { using F = decltype(f); - constexpr auto ro = describe::has_attr_v; + constexpr auto ro = describe::has_v; if constexpr (!ro) { if (!hit && f.name == sk.second) { hit = true; diff --git a/tests/main.cpp b/tests/main.cpp index e28b2d0..78f000b 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -22,7 +22,13 @@ struct Person { return "Hello " + name; } }; -DESCRIBE(Person, &_::name, &_::age, &_::Hello) + +DESCRIBE("Person", Person) { + MEMBER("name", &_::name); + MEMBER("age", &_::age); + MEMBER("Hello", &_::Hello); +} + static std::string GreetAnother(Person* a, Person* b) { return "Hello from: " + a->name + " to: " + b->name;