mirror of
https://github.com/vimpunk/mio.git
synced 2025-12-06 16:57:01 +08:00
Second follow up attempt to fix MSVC SFINAE build error
This commit is contained in:
parent
261acc6bc6
commit
bd14437895
@ -324,8 +324,7 @@ void basic_mmap<AccessMode, ByteT>::map(const handle_type handle,
|
||||
}
|
||||
|
||||
template<access_mode AccessMode, typename ByteT>
|
||||
template<access_mode, typename /*SFINAE*/>
|
||||
void basic_mmap<AccessMode, ByteT>::sync(std::error_code& error)
|
||||
void basic_mmap<AccessMode, ByteT>::sync_impl(std::error_code& error)
|
||||
{
|
||||
error.clear();
|
||||
if(!is_open())
|
||||
|
||||
@ -344,7 +344,10 @@ public:
|
||||
template<
|
||||
access_mode A = AccessMode,
|
||||
typename = typename std::enable_if<A == access_mode::write>::type
|
||||
> void sync(std::error_code& error);
|
||||
> void sync(std::error_code& error)
|
||||
{
|
||||
sync_impl(error);
|
||||
}
|
||||
|
||||
/**
|
||||
* All operators compare the address of the first byte and size of the two mapped
|
||||
@ -375,6 +378,15 @@ private:
|
||||
conditional_sync();
|
||||
template<access_mode A = AccessMode>
|
||||
typename std::enable_if<A == access_mode::read, void>::type conditional_sync();
|
||||
|
||||
/**
|
||||
* Due to MSVC's fragile SFINAE support (see
|
||||
* https://github.com/mandreyel/mio/issues/300), we need to have `sync`
|
||||
* defined inline so that `conditional_sync` sees the definition. To not
|
||||
* clutter the API, the implementation is extracted into this non-SFINAE
|
||||
* private member function.
|
||||
*/
|
||||
void sync_impl(std::error_code& error);
|
||||
};
|
||||
|
||||
template<access_mode AccessMode, typename ByteT>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user