For device type D, boost::iostreams::stream&lt;D&gt; defines D&amp; operator*() and D* operator-&gt;()<div>Clients of your stream can use them to access the buffer<br><br><div class="gmail_quote">2012/10/16 Gheorghe Marinca <span dir="ltr">&lt;<a href="mailto:gheorghe.marinca@gmail.com" target="_blank">gheorghe.marinca@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hy,<br><br>I want to implement a boost iostream MemoryInputStream like this:<br><br>class MemoryInputDevice : public boost::iostreams::source<br clear="none">

{<br clear="none">    public:<br clear="none">        MemoryInputDevice(char* buffer, size_t size): buffer(buffer), size(size), pos(0)<br clear="none">
        {<br clear="none">        }<br clear="none"><br clear="none">        std::streamsize read(char* s, std::streamsize n);<br clear="none"><br clear="none">    private:<br clear="none">        char* buffer;<br clear="none">


        std::streamsize size;<br clear="none">        std::streamsize pos;<br clear="none">};<br><br>typedef boost::iostreams::stream&lt;MemoryInputDevice&gt; MemoryInputStream;<br><br>I want at the same time to expose to clients beside the istream interface a way for the client to get the pointer to the internal buffer and it&#39;s length (getting the pointer to the internal buffer could be questionable but in order not to copy buffer around there are cases where a parser of mine needs all the content of the internal buffer and I don&#39;t want to copy that around before passing it to the parser)<br>


<br>Is therea  way for MemoryInputStream user to get that info ? I was thinking at the stream-&gt;rdbuffer() method but it seems it does not give me what I want.<br>Thanks in advance for your help<br><br>-Ghita<br>
<br>_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br>
<a href="http://listarchives.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://listarchives.boost.org/mailman/listinfo.cgi/boost-users</a><br></blockquote></div><br></div>

