title: Manipulate with boost buffer
body: <p>I'm writing server with streaming protocol, so I need to do things like find end of header, copy it and then parse other stuff in boost buffer. As I found out the best way for manipulation with strings (find string in it, copy/delete using iterators and so on) is std::string. But I'm using char array buffer. So I'll need to have two buffers - char array and std::string - every time I'll need to manipulate with buffer I'll need to convert char array to std::string, do my stuff and then convert it back to char array using std::string.c_str(). Another way I found is use streambuf (as I asked in my previous <a href="https://stackoverflow.com/questions/10764986/use-streambuf-as-buffer-for-boost-asio-read-and-write">questition</a>) and then create istream/ostream to it and fill content from it to std::string (as showed in <a href="http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/reference/streambuf.html" rel="nofollow noreferrer">documentation</a>). 
  With streambuf I'll need :<br>
  streambuf<br>
  mutable_buffers_type<br>
  istream<br>
  ostream<br>
  and std::string<br>
  But with use of char array and std::string I need just :<br>
  char array<br>
  std::string  </p>
  
  <p>So I think use of streambuf is waste of memory (I need to create buffer for every connection). Can I use std::string as boost buffer ? However I think there may be better way to do this. Can you give me an advice ?</p>
  
  <p>EDIT:</p>
  
  <p>I need to do something like this with my buffer, but char array don't offer features like std::string (erase, substr, ...) so I need to use std::string as buffer. What is the best way to use it as boost::buffer or what is the best way for parsing like this code ?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main(int argc, char* argv[])
  {
  
      //"header" is header
      //"end" is marking that this point is end of header
      //"data" is data after header
      //this all is sent in one packet which I receive to buffer
      //I need to fill "headerend" to std::string header and then remove "headerend" from begining of buffer
      //then continue parsing "data" which stay in buffer
  
      std::string buffer = "headerenddata"; //I receive something like this
      std::string header; //here I'll fill header (including mark of end of header)
  
      //find end of header and include also mark of end of header which is "end" (+3)
      int endOfHeader = int(buffer.find("end"))+3; 
  
      //fill header from buffer to string header
      header = buffer.substr(0, endOfHeader);
  
      //delete header from input buffer and keep data in it for next parsing
      buffer.erase(buffer.begin(), buffer.begin()+endOfHeader); 
      //will be just "data" becouse header and mark of header are removed
      std::cout &lt;&lt; buffer &lt;&lt; std::endl; 
      //will be "headerend" which is "header" and mark end of header which is "end"
      std::cout &lt;&lt; header &lt;&lt; std::endl;
  
  
      return 0;
  }
  </code></pre>