Defined in File MemoryMappedFile.hpp
This class is a wrapper to os-dependend file mapping implementations. It supports to map a read-only file into virtual address space. After successful opening, pointers to the begin/end of the virtual address space are accessible via cbegin() / cend(). All file and mapping handlers are freed automatically.
This wrapper is non-copyable but can be cheaply moved and swapped.
Public Functions
Creates a MemoryMappedFile instance in an unmapped state. A call to open() is required.
Invokes open(path) automatically.
Invokes close.
It’s non copy-able.
Takes over the mapping (if any) from o, leaves o in a “closed” state ready to be opened again.
If *this currently holds a mapping, it is closed and replaced the other’s state which in turn is left closed.
Opens the file and maps it to cbegin() … cend() Opening an empty file is considered an error.
If a file is mapped, it is closed. Otherwise, operation is carried out.
Note
This function is automatically called by the destructor.
If a file is opened, a random-access iterator to the first byte mapped is returned. If no file is opened, nullptr is returned.
Analogously to cbegin()
Number of bytes mapped.