mirror of
https://github.com/CHN-beta/nixos.git
synced 2024-10-24 05:08:44 +08:00
18 lines
427 B
C++
18 lines
427 B
C++
|
# include <biu.hpp>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
struct student
|
||
|
{
|
||
|
int number;
|
||
|
std::string name;
|
||
|
std::vector<std::optional<double>> grade;
|
||
|
using serialize = zpp::bits::members<3>;
|
||
|
auto operator<=>(const student&) const = default;
|
||
|
};
|
||
|
student bob{ 123, "Bob", { 3.5, std::nullopt, 4.0 } };
|
||
|
auto serialized_bob = biu::serialize(bob);
|
||
|
auto bob2 = biu::deserialize<student>(serialized_bob);
|
||
|
assert(bob == bob2);
|
||
|
}
|