Open filename and map it in memory. If Datum is const, opens for read-only and maps the content in memory; no error is issued if the file does not exist. This makes it easy to treat a non-existing file as empty.
Frees resources associated with this mapping. However, it does not deallocate the name.
Queries whether this is currently associated with a file.
Frees resources associated with this mapping. However, it does not deallocate the name. Reinitializes this as a fresh object that can be reused.
Deletes the underlying file and frees all resources associated. Reinitializes this as a fresh object that can be reused.
Queries the length of the file associated with this mapping. If not active, returns 0.
Unconditionally and destructively moves the underlying file to filename. If the operation succeeds, returns true. Upon failure, prints a message to stderr and returns false. In all cases it closes the underlying file.
Get a slice to the contents of the entire file.
Resizes the file and mapping to the specified size.
the mapped data type: Use a POD of size 1 for read/write mapping and a const version thereof for read-only mapping. Other primitive types should work, but have not been yet tested.
Encapsulated management of a memory-mapped file.