Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: streambuf and stringstreambuf

$
0
0
Can you give me an example of how I can use raw pointer (I am assuming you are talking about char* or wchar_t*?) for get_line()? in std::streambuf has a method str() which can be used to reset the buffer to a new string but it reallocates the memory. Also how is streambuf converted into a std::string? I am really struggling with streambuf/stringstreambuf. Seriously I am spending more time on figuring out stream types than writing real code.

I think get_line() or other such function should have an easier way for the client to use different string type (ex: wchar_t*)so it can be by default made efficient. Right now it seems everything is for one time use. If you have a class that will be re-used many times but calling each of these function will cause buffer re-allocation it mean by design it's inefficient as a choice. It would be better if by design you offer the more efficient choice because nobody will use these methods once in the life spawn of the app. If allocation is already efficient (ie: only reallocating if buffer is too small) than it should provide an efficient way to clear the buffer for better re-use as well (I need an example for my above question foremost).

I hope this didn't sound like a rant;)

Viewing all articles
Browse latest Browse all 4845


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>