Second follow up attempt to fix MSVC SFINAE build error

This commit is contained in:
mandreyel 2018-11-07 12:08:41 +01:00
parent 261acc6bc6
commit bd14437895
2 changed files with 14 additions and 3 deletions

View File

@ -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())

View File

@ -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>