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

Parsing from std::string_view #269

Closed
GoldsteinE opened this issue Nov 20, 2024 · 3 comments
Closed

Parsing from std::string_view #269

GoldsteinE opened this issue Nov 20, 2024 · 3 comments

Comments

@GoldsteinE
Copy link

GoldsteinE commented Nov 20, 2024

Currently e.g. rfl::json provides two ways to parse a string: from std::string or from std::istream (where the second delegates to the first). That means that parsing from std::string_view currently requires an allocation. yyjson_read() doesn’t take ownership of the passed string, so parsing directly from std::string_view should be possible unless I’m missing something.

I think the same holds for other formats, but I only checked yyjson and pugixml.

@liuzicheng1987
Copy link
Contributor

@GoldsteinE , true, none of the formats support std::string_view. But it would be a good idea and should be fairly easy to implement.

@liuzicheng1987
Copy link
Contributor

Resolved; #312

@GoldsteinE
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants