Skip to content

Commit

Permalink
Update to describe 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanidle committed Dec 17, 2024
1 parent f0ad9ee commit c738e20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion include/glua/glua.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReadOnly, F>;
constexpr auto ro = describe::has_v<ReadOnly, F>;
if constexpr (!ro) {
if (!hit && f.name == sk.second) {
hit = true;
Expand Down
8 changes: 7 additions & 1 deletion tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c738e20

Please sign in to comment.