Third follow up attempt to fix MSVC SFINAE build error

This commit is contained in:
mandreyel 2018-11-07 12:31:59 +01:00
parent bd14437895
commit 45e5fcde97
2 changed files with 6 additions and 17 deletions

View File

@ -324,7 +324,9 @@ void basic_mmap<AccessMode, ByteT>::map(const handle_type handle,
} }
template<access_mode AccessMode, typename ByteT> template<access_mode AccessMode, typename ByteT>
void basic_mmap<AccessMode, ByteT>::sync_impl(std::error_code& error) template<access_mode A>
typename std::enable_if<A == access_mode::write, void>::type
basic_mmap<AccessMode, ByteT>::sync(std::error_code& error)
{ {
error.clear(); error.clear();
if(!is_open()) if(!is_open())

View File

@ -341,13 +341,9 @@ public:
void swap(basic_mmap& other); void swap(basic_mmap& other);
/** Flushes the memory mapped page to disk. Errors are reported via `error`. */ /** Flushes the memory mapped page to disk. Errors are reported via `error`. */
template< template<access_mode A = AccessMode>
access_mode A = AccessMode, typename std::enable_if<A == access_mode::write, void>::type
typename = typename std::enable_if<A == access_mode::write>::type 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 * All operators compare the address of the first byte and size of the two mapped
@ -378,15 +374,6 @@ private:
conditional_sync(); conditional_sync();
template<access_mode A = AccessMode> template<access_mode A = AccessMode>
typename std::enable_if<A == access_mode::read, void>::type conditional_sync(); 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> template<access_mode AccessMode, typename ByteT>