From 261acc6bc690a77d6cae4f5d4c837f9a2634862c Mon Sep 17 00:00:00 2001 From: mandreyel Date: Wed, 7 Nov 2018 11:40:37 +0100 Subject: [PATCH] Follow up attempt to fix MSVC SFINAE build error --- include/mio/detail/mmap.ipp | 19 +++++++++++++++++++ include/mio/mmap.hpp | 15 ++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/include/mio/detail/mmap.ipp b/include/mio/detail/mmap.ipp index a813fc3..a068891 100644 --- a/include/mio/detail/mmap.ipp +++ b/include/mio/detail/mmap.ipp @@ -418,6 +418,25 @@ void basic_mmap::swap(basic_mmap& other) } } +template +template +typename std::enable_if::type +basic_mmap::conditional_sync() +{ + // This is invoked from the destructor, so not much we can do about + // failures here. + std::error_code ec; + sync(ec); +} + +template +template +typename std::enable_if::type +basic_mmap::conditional_sync() +{ + // noop +} + template bool operator==(const basic_mmap& a, const basic_mmap& b) diff --git a/include/mio/mmap.hpp b/include/mio/mmap.hpp index fd18d2b..2d18cd9 100644 --- a/include/mio/mmap.hpp +++ b/include/mio/mmap.hpp @@ -370,18 +370,11 @@ private: * if it's `read`, but since the destructor cannot be templated, we need to * do SFINAE in a dedicated function, where one syncs and the other is a noop. */ - template::type> - void conditional_sync() - { - // This is invoked from the destructor, so not much we can do about - // failures here. - std::error_code ec; - sync(ec); - } - template - typename std::enable_if::type conditional_sync() {} + typename std::enable_if::type + conditional_sync(); + template + typename std::enable_if::type conditional_sync(); }; template