mirror of
https://github.com/vimpunk/mio.git
synced 2025-12-06 16:57:01 +08:00
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:
parent
45e5fcde97
commit
cc9e98f382
@ -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,7 +128,7 @@ public:
|
||||
map(handle, offset, length, error);
|
||||
if(error) { throw std::system_error(error); }
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
* `basic_mmap` has single-ownership semantics, so transferring ownership
|
||||
* may only be accomplished by moving the object.
|
||||
|
||||
@ -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
|
||||
|
||||
/**
|
||||
* If this is a read-write mapping and the last reference to the mapping,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user