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

The header and write callback now uses a std::string_view as argument for data to avoid copying #1081

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

COM8
Copy link
Member

@COM8 COM8 commented Jul 10, 2024

Old

std::function<bool(std::string data, intptr_t userdata)> callback;

New

std::function<bool(const std::string_view& data, intptr_t userdata)> callback;

With the new way we avoid copying the payload.

@COM8 COM8 added this to the CPR 1.11.0 milestone Jul 10, 2024
@COM8 COM8 self-assigned this Jul 10, 2024
@COM8 COM8 merged commit b5a21de into master Jul 10, 2024
32 of 105 checks passed
@COM8 COM8 deleted the feature/callback_user_string_view branch July 10, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WriteCallback should take a string_view as argument instead of a std::string to avoid a copy
1 participant