简体   繁体   中英

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

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 -> 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM