Created
March 1, 2016 22:02
-
-
Save psiha/c0823fefc01fa3b39662 to your computer and use it in GitHub Desktop.
WannabeBoost.MMAP demo1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BOOST_MMAP_HEADER_ONLY | |
#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