Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 654 Bytes

README.md

File metadata and controls

25 lines (16 loc) · 654 Bytes

MemoryMapped

... is a thin wrapper around memory-mapping facilities.
Specifically, mmap on Linux, and CreateFileMapping on Windows.

Example:

MemoryMapped::File fh("thing");

// loop over mapped data ...
for(size_t i=0; i<fh.size(); i++)
{
    do_something_with(fh[i]);
}

// or use the chunk directly
std::cout.write(fh.data(), fh.size());

// MemoryMapped knows about RAII, but you're a nice programmer who wouldn't
// just leave memory chunks hanging around. Right?
fh.close();

See also test.cpp, which accepts a single argument as file and open/read/prints it.