ArtemGr <artemciy@...> writes:
> Tommi Mäkitalo <tommi <at> ...> writes:
> > Yeah great. There is a split also:
> > You should really use that. Gosh - I would like to know how that works. 
> Hey, it's just a thoroughly generic function.

BTW, I've been decompressing a large text into a __gnu_cxx::crope
and found that Boost can split it NP:

  void* litfBytes = mmap (nullptr, alignedSize, PROT_READ, MAP_SHARED,
litfFd, 0);
  ...
  crope litfBody; xzDecompress ((const char*) litfBytes, (int) litfSize,
litfBody);
  boost::split_iterator<crope::const_iterator> litfTags (litfBody.begin(),
litfBody.end(), boost::token_finder (boost::is_cntrl(),
boost::token_compress_on));
  string tag; while (!litfTags.eof()) {
    tag.clear(); std::copy (litfTags->begin(), litfTags->end(),
std::back_inserter (tag));
    cout << tag << endl;
    ++litfTags;
  }

This is not faster than collapsing the Rope into c_str, because the Rope
iterators are slow, but it shows that Boost split is just as flexible as the
standard library algorithms.

Here is the faster version, BTW, which collapses the Rope into c_str:

  const char* litfChars = litfBody.c_str();
  boost::split_iterator<const char*> litfTags (litfChars, litfChars +
litfBody.size(), boost::token_finder (boost::is_cntrl(),
boost::token_compress_on));



------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to