Boost equivalent of std::getline for boost::static_string

Viewed 71

I am changing my datatypes from std::string to boost::static_string, as I realized that when I write on file, I get 8 seconds with Boost against 25 seconds with the STL.

I was using std::getline for parsing the input, but that is obviously not compatible with boost::static_string. Which is the Boost equivalent of std::getline that works with boost::static_string specifically?

1 Answers

I was using std::getline for parsing the input, but that is obviously not compatible with boost::static_string

You'd probably phrase it in terms of istream::read (which takes char*, size_t).

for parsing the input

In this case, why don't you share the input so we can solve the XY problem? The code being performance critical YET using iostreams for parsing seems like a very stark contradiction to me.

  • 50% chance that you can just keep using std::getline with std::string (and convert to static_string) because the parsing is not on any performance critical path
  • 50% chance that the real perf bottleneck is in the parsing, and I'd love to show you alternatives (using Boost)
Related