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

Can I write to buffer? #161

Open
JaydenFish opened this issue Jul 24, 2024 · 1 comment
Open

Can I write to buffer? #161

JaydenFish opened this issue Jul 24, 2024 · 1 comment

Comments

@JaydenFish
Copy link

std::string is not a good idea. It's better to write rfl::json::write to a buffer just like char[], std::array...
In this way I can eliminate a copy on socket or something.

@liuzicheng1987
Copy link
Contributor

liuzicheng1987 commented Jul 24, 2024

You can write into any std::ostream or read from any std::istream precisely for that reason.

std::array couldn't work, because you would have to know the size of the string at compile time, which is hardly ever the case.

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