Boost logo

Boost Users :

Subject: [Boost-users] [boost-users] converting InputIterator to ForwardIterator
From: Igor R (boost.lists_at_[hidden])
Date: 2009-03-11 12:45:34


I'd like to do the subj, in order to be able to apply some std
algorithms to files, like this:

ifstream file("myfile", std::ios::binary|std::ios::in);
std::string delim("\r\n\r\n"); // sequence to search
typedef std::istreambuf_iterator<char> iterator;
iterator begin(file), end;
iterator pos = std::find_end(begin, end, delim.begin(), delim.end());
// won't work, because istreambuf_iterator is *not* ForwardIterator

I found something called multi_pass in boost::spirit. However, I'm not
sure if it's relevant or deprecated class (it seems to be a part of
the "old" Spirit), and whether this's the only Boost utility I can use
to perform the above conversion.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at