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

Add more advanced initializer_list support #506

Open
jviotti opened this issue Feb 24, 2024 · 2 comments
Open

Add more advanced initializer_list support #506

jviotti opened this issue Feb 24, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@jviotti
Copy link
Member

jviotti commented Feb 24, 2024

Like https://github.com/nlohmann/json does:

json j2 = {
  {"pi", 3.141},
  {"happy", true},
  {"name", "Niels"},
  {"nothing", nullptr},
  {"answer", {
    {"everything", 42}
  }},
  {"list", {1, 0, 2}},
  {"object", {
    {"currency", "USD"},
    {"value", 42.99}
  }}
};
@tony-go
Copy link
Contributor

tony-go commented Mar 23, 2024

@jviotti
Copy link
Member Author

jviotti commented Mar 23, 2024

Exactly. The point being that otherwise we often have to create stringified JSON documents and pass them through sourcemeta::jsontoolkit::parse() (which is relatively slow), while with these kind of literals, we directly allocate the document and avoid parsing (much faster).

@jviotti jviotti added enhancement New feature or request and removed important labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants