Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

现在不在支持struct结构体转json了吗 #54

Open
chendj0710 opened this issue Apr 26, 2024 · 3 comments
Open

现在不在支持struct结构体转json了吗 #54

chendj0710 opened this issue Apr 26, 2024 · 3 comments

Comments

@chendj0710
Copy link

你好,我发现example/testType.h大多都是通过添加F_CLASS(xxx)将其转换成类的形式,只有struct TestType是结构体的形式。
但是在example.cpp中放开下面代码,编译就会报错

REGISTEREDMEMBER(TestType, age1, age2, age3, age4, age5, age6, age7, age8);

报错内容

In file included from testType.h:5:0,
from example.cpp:14:
example.cpp: In function ‘int main()’:
../FStruct.h:2463:1: error: expected primary-expression before ‘public’
public:\

是现在不再支持struct xxx, 然后调用REGISTEREDMEMBER注册成员的方式了吗,还是我的使用有问题呀

@HuaGouFdog
Copy link
Owner

支持的,REGISTEREDMEMBER(TestType, age1, age2, age3, age4, age5, age6, age7, age8); 这种是早期实现的非入侵式的写法,后面发现不如侵入式好维护,就改了注册方式,直接在结构体内部注册,就是F_CLASS,可以看一下readme,要使用新的方法。

@HuaGouFdog
Copy link
Owner

是的,现在不支持struct xxx, 然后调用REGISTEREDMEMBER注册了,大量结构体不好维护,不如在定义处维护方便。

@chendj0710
Copy link
Author

好的,谢谢

是的,现在不支持struct xxx, 然后调用REGISTEREDMEMBER注册了,大量结构体不好维护,不如在定义处维护方便。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants