Skip to content

Json variant supports creating types from field - #334

Open
fesily wants to merge 4 commits into
qicosmos:masterfrom
fesily:json-variant-supports-creating-types-from-field
Open

Json variant supports creating types from field#334
fesily wants to merge 4 commits into
qicosmos:masterfrom
fesily:json-variant-supports-creating-types-from-field

Conversation

@fesily

@fesily fesily commented Nov 30, 2024

Copy link
Copy Markdown

No description provided.

@qicosmos

qicosmos commented Dec 2, 2024

Copy link
Copy Markdown
Owner

这个pr是为了解决什么问题呢?

请增加一下描述,描述为什么要这个pr,通过一个example 来展示pr的作用。

@fesily

fesily commented Dec 7, 2024

Copy link
Copy Markdown
Author

我只是想兼容一下旧的交互协议,json中同一个字段中实际混杂了多个不同构造函数的结构体,本质上相当于

struct Base {
  int a;
};
struct A : Base {
 std::string b;
};
struct B : Base {
  double b;
};

反序列化基类,但是根据字段创建具体的子类

@qicosmos

qicosmos commented Dec 8, 2024

Copy link
Copy Markdown
Owner

还是没有理解,你用伪代码解释一下吧,啥叫兼容新旧交互协议。pr的测视代码也没有体现这个呀。

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.

2 participants