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][fix]fix json #440

Merged
merged 3 commits into from
Sep 4, 2023
Merged

[struct_json][fix]fix json #440

merged 3 commits into from
Sep 4, 2023

Conversation

qicosmos
Copy link
Collaborator

@qicosmos qicosmos commented Sep 4, 2023

Why

fix a bug in from_json.

What is changing

Example

struct person1 {
  std::shared_ptr<std::string> name;
  std::unique_ptr<int64_t> age;
};
REFLECTION(person1, name, age);

void use_smart_pointer() {
  person1 p{std::make_shared<std::string>("tom"),
            std::make_unique<int64_t>(42)};
  std::string str;
  iguana::to_json(p, str);

  person1 p1;
  iguana::from_json(p1, str); 

  assert(*p1.name == "tom");
  assert(*p1.age == 42);
}

@qicosmos qicosmos merged commit d961c21 into alibaba:main Sep 4, 2023
28 checks passed
@qicosmos qicosmos deleted the fix_json branch September 4, 2023 07:06
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

Successfully merging this pull request may close these issues.

1 participant