Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WannabeBoost.MMAP demo1
#include <boost/mmap/mapped_view/mapped_view.hpp>
#include <boost/mmap/mappable_objects/file/utility.hpp>
int main( int /*argc*/, char * /*argv*/[] ) noexcept
auto maybe_foo_view( boost::mmap::map_read_only_file( "foo" )() );
if ( !maybe_foo_view )
return static_cast<int>( maybe_foo_view.error() );
if ( maybe_foo_view->empty() )
return -1;
return (*maybe_foo_view)[ 0 ];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment