Conditionally enable the exception-throwing constructors

This allows MIO to be compiled with -fno-exceptions, as that is the
only place where MIO uses them.
This commit is contained in:
easyaspi314 (Devin) 2018-11-08 23:32:14 -05:00
parent 45e5fcde97
commit cc9e98f382
2 changed files with 4 additions and 1 deletions

View File

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

View File

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