Skip to content

Commit

Permalink
[website] fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuHyA authored and poor-circle committed Jul 8, 2024
1 parent 1cd307a commit 9778980
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/docs/zh/struct_pack/struct_pack_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ class person : std::vector<int> {
};
STRUCT_PACK_REFL(person, name, age);
}
```

`STRUCT_PACK_REFL(typename, fieldname1, fieldname2 ...)`填入的第一个参数是需要反射的类型名,随后是若干个字段名,代表反射信息的各个字段。
该宏必须定义在反射的类型所在的命名空间中。
如果该类型不具有默认构造函数,则无法使用函数`struct_pack::deserialize`,不过你依然可以使用`struct_pack::deserialize_to`来实现反序列化。
它使得struct_pack可以支持那些非聚合的结构体类型,允许用户自定义构造函数,继承其他类型,添加不序列化的字段等等。
```

有时,用户需要序列化/反序列化那些private字段,这可以通过函数`STRUCT_PACK_FRIEND_DECL(typenmae)`;来支持。
```cpp
Expand Down

0 comments on commit 9778980

Please sign in to comment.