13 Feb
2019
13 Feb
'19
8:15 p.m.
On 13/02/2019 04:43, Richard Hodges via Boost-users wrote:
My solution would be:
1. memory map the file (either use boost.interprocess or trivially hand-roll a few OS calls) 2. build an iterator pair (i.e. char *) representing the extent of the mapped memory, 3. call std::make_reverse_iterator on the iterator pair 4. use a standard algorithm
Unless the file is warm cached, this will be slow. I know of no kernel which performs readbehind, only readahead. Safer is to do as Gavin suggests, jump to some offset from the maximum extent, read forwards. Niall