开发者

boosts buffer into char* (no std::string)

开发者 https://www.devze.com 2022-12-14 06:20 出处:网络
So, it may be sounds as a realy newbies question... And proboly it is newbies :) I try to turn infomation from boost::asio::streambuf which I got, using read_until into char*. I\'ve found realy many

So, it may be sounds as a realy newbies question... And proboly it is newbies :)

I try to turn infomation from boost::asio::streambuf which I got, using read_until into char*. I've found realy many examples of turning it into std::string, but I'd mad, if use bufer -> std::string -> 开发者_Go百科c_str in an application, needs a high perfomanse. (But in fact, I ectally do not realy stuff like conteiners and so on.)


You are assuming that converting a std::string into a C string hurts performance.

This should not be assumed. std::string is often implemented as a wrapper around a C string.

If you are unhappy with current performance, start by using a run-time profiler on your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消