On 9/08/2016 17:13, knarks@online.de wrote:
At the moment I'm using async_read with boost::asio::streambuf and this works fine but I need a custom stream where every invoke to async_read appends the data to my stream.
Asio streambuf already does this, so I'm not sure why you'd want to make a custom one on that basis.
The stream should be based on std::streambuf because I want to keep the asio interface hidden to the user.
While I understand the motivation, note that some of the performance of Asio relies on the compiler being able to inline things. There's certainly nothing stopping you from hiding it but you'll lose some of the benefits this way. Some of the special features such as strands and custom allocators also rely on the way that the templates interact. And Asio's streambuf is already based on std::streambuf; to make a custom one you'd end up completely duplicating it anyway.
My first idea was to search for the problem and I ended up with reading about MutableBufferSequence but I don't know if this is the right way and how to implement this in my streambuf object. Any help is higly appreciated.
Asio does support using many other data sequences as buffers, so you can just use something else other than streambuf if you wish to. http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/overview/core/buffe...