You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 12, 2018. It is now read-only.
using string_view = const std::string &; // TODO c++17: use std::string_view
I changed this line to:
using string_view = std::string_view;
and life became wonderful. My application keeps data in char* format (with a known size_t). I was pushing these char* buffers into streams, and passing them to request. I realized that this results in 2 copies of the data (one to create my stream, and another request uses << to push that stream into ASIO).
string_view solves this wonderfully, as it simply wraps the pointer and length, and results in one less copy (some of my transfers are over 100mb, making copies painful and memory intensive).
I realize your original code comment might have to do with C++17 feature detection, but I think this can be cured with the following:
Simple-Web-Server/client_http.hpp
Line 19 in 1056bd2
I changed this line to:
and life became wonderful. My application keeps data in
char*format (with a knownsize_t). I was pushing thesechar*buffers into streams, and passing them torequest. I realized that this results in 2 copies of the data (one to create my stream, and anotherrequestuses<<to push that stream into ASIO).string_viewsolves this wonderfully, as it simply wraps the pointer and length, and results in one less copy (some of my transfers are over 100mb, making copies painful and memory intensive).I realize your original code comment might have to do with C++17 feature detection, but I think this can be cured with the following:
Super-ultra-nice would be versions of request that took a
char*and asize_t, I could see this being a super common use case.