-
Notifications
You must be signed in to change notification settings - Fork 238
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_pack] how to support QString and QTL of Qt #764
Comments
struct Test
{
QString str;
QVector iArray;
QMap<QString, QString> name2Sb;
};
template <>
constexpr std::size_t struct_pack::members_count<Test> = 3; Could you try this? |
It’s not working. |
Could you show me the error message |
Here is a example of support third-party type: |
You can add the helper function in QT namespace to support Qstring/QVector/QMap. |
The error message was Yes! I am learning how to integrate third party library types and it is a learning process. Thanks a lot! |
Or you can try this: struct Test
{
QString str;
QVector iArray;
QMap<QString, QString> name2Sb;
};
STRUCT_PACK_REFL(Test, str, iArray, name2Sb); |
I registered QString、QVector、QMap with sp_get_needed_size、sp_serialize_to、sp_deserialize_to,and used STRUCT_PACK_REFL(Test, str, iArray, name2Sb); The complier error message: read_bytes_array Cannot find identifier(找不到标识符) |
Sorry for my late, it's a code bug, fixed by #776 |
强!我更新到最新版本了,发现部分宏都改变了,源码文件也有些改动。试了一下,问题迎刃而解了。非常感谢! |
Search before asking
What happened + What you expected to happen
When i use struct_pack to serialized a struct like below
struct Test
{
QString str;
QVector iArray;
QMap<QString, QString> name2Sb;
};
An error occurred during compile when i use struct_pack::serializestd::string(Test):1.If the struct is empty,which is not allowed in struct_pack type system.
Reproduction way
Anything else
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: