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

Proposal: friendly list initialization for document or node. #58

Open
liuq19 opened this issue Mar 17, 2023 · 2 comments
Open

Proposal: friendly list initialization for document or node. #58

liuq19 opened this issue Mar 17, 2023 · 2 comments
Labels

Comments

@liuq19
Copy link
Collaborator

liuq19 commented Mar 17, 2023

Now, initialization is complex as follows:

Document doc;
doc.SetObject();
doc.AddMember(key, value);

Can we use the c++11 initialization list:

Document doc { {"a", "b"}, {"c", false}, {"d", {1, 2, 3}}};
@liuq19 liuq19 changed the title proposal: friendly initialization for document or node. proposal: friendly list initialization for document or node. Mar 17, 2023
@liuq19 liuq19 changed the title proposal: friendly list initialization for document or node. Proposal: friendly list initialization for document or node. Mar 17, 2023
@xiegx94
Copy link
Collaborator

xiegx94 commented Mar 22, 2023

I don't think this is correct c++ syntax.

@liuq19
Copy link
Collaborator Author

liuq19 commented Mar 28, 2023

A typo has been fixed and C++11 has supported list initialization. However, the main issue is how to differentiate between object and array types. For a example, doc{"a", 1} may be Array["a", 1] and Object{"a", 1}.

@liuq19 liuq19 added the good first issue Good for newcomers label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants