title: Efficient parsing of mmap file
body: <p>Following is the code for creating a memory map file using boost.</p>
  
  <pre><code>boost::iostreams::mapped_file_source file;  
  boost::iostreams::mapped_file_params param;  
  param.path = "\\..\\points.pts";  //! Filepath  
  file.open(param, fileSize);  
  if(file.is_open())  
  {  
    //! Access the buffer and populate the ren point buffer  
    const char* pData = file.data();  
    char* pData1 = const_cast&lt;char*&gt;(pData);  //! this gives me all the data from Mmap file  
    std::vector&lt;RenPoint&gt; readPoints;  
    ParseData( pData1, readPoints);
  }  
  </code></pre>
  
  <p>The implementation of ParseData is as follows  </p>
  
  <pre><code>void ParseData ( char* pbuffer , std::vector&lt;RenPoint&gt;&gt;&amp; readPoints)    
  {
    if(!pbuffer)
  throw std::logic_error("no Data in memory mapped file");
  
  stringstream strBuffer;
  strBuffer &lt;&lt; pbuffer;
  
  //! Get the max number of points in the pts file
  std::string strMaxPts;
  std::getline(strBuffer,strMaxPts,'\n');
  auto nSize = strMaxPts.size();
  unsigned nMaxNumPts = GetValue&lt;unsigned&gt;(strMaxPts);
  readPoints.clear();
  
  //! Offset buffer 
  pbuffer += nSize;
  strBuffer &lt;&lt; pbuffer;
  std::string cur_line;
  while(std::getline(strBuffer, cur_line,'\n'))
  {
         //! How do I read the data from mmap file directly and populate my renpoint structure    
             int yy = 0;
  }
  
  //! Working but very slow
  /*while (std::getline(strBuffer,strMaxPts,'\n'))
  {
      std::vector&lt;string&gt; fragments;
  
      istringstream iss(strMaxPts);
  
      copy(istream_iterator&lt;string&gt;(iss),
          istream_iterator&lt;string&gt;(),
          back_inserter&lt;vector&lt;string&gt;&gt;(fragments));
  
      //! Logic to populate the structure after getting data back from fragments
      readPoints.push_back(pt);
  }*/
  }  
  </code></pre>
  
  <p>I have say a minimum of 1 million points in my data structure and I want to optimize my parsing. Any ideas ?  </p>