Boost logo

Boost Users :

Subject: Re: [Boost-users] Reading a file in reverse using boost::iostreams
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2019-02-13 20:15:27

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.


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