Merge pull request #31 from easyaspi314/master

Conditionally enable the exception-throwing constructors
This commit is contained in:
mandreyel 2018-11-09 20:32:38 +01:00 committed by GitHub
commit 321bb4d89c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -50,6 +50,8 @@ or:
```c++
mmap.map(path, error);
```
**NOTE:** The constructors **require** exceptions to be enabled. If you prefer
to build your projects with `-fno-exceptions`, you can still use the other ways.
Moreover, in each case, you can provide either some string type for the file's path, or you can use an existing, valid file handle.
```c++

View File

@ -103,6 +103,7 @@ public:
*/
basic_mmap() = default;
#ifdef __cpp_exceptions
/**
* The same as invoking the `map` function, except any error that may occur
* while establishing the mapping is wrapped in a `std::system_error` and is
@ -127,6 +128,7 @@ public:
map(handle, offset, length, error);
if(error) { throw std::system_error(error); }
}
#endif // __cpp_exceptions
/**
* `basic_mmap` has single-ownership semantics, so transferring ownership

View File

@ -87,6 +87,7 @@ public:
return *this;
}
#ifdef __cpp_exceptions
/**
* The same as invoking the `map` function, except any error that may occur
* while establishing the mapping is wrapped in a `std::system_error` and is
@ -111,6 +112,7 @@ public:
map(handle, offset, length, error);
if(error) { throw std::system_error(error); }
}
#endif // __cpp_exceptions
/**
* If this is a read-write mapping and the last reference to the mapping,