Skip to content

Commit ba2c4ec

Browse files
authored
Backport DetourAttach overloads to C++11 (microsoft#180)
1 parent 58a61c7 commit ba2c4ec

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/detours.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -846,18 +846,18 @@ VOID CALLBACK DetourFinishHelperProcess(_In_ HWND,
846846

847847
/////////////////////////////////////////////////// Type-safe overloads for C++
848848
//
849-
#if __cplusplus >= 201402L || _MSVC_LANG >= 201402L
849+
#if __cplusplus >= 201103L || _MSVC_LANG >= 201103L
850850
#include <type_traits>
851851

852852
template<typename T>
853853
struct DetoursIsFunctionPointer : std::false_type {};
854854

855855
template<typename T>
856-
struct DetoursIsFunctionPointer<T*> : std::is_function<std::remove_pointer_t<T>> {};
856+
struct DetoursIsFunctionPointer<T*> : std::is_function<typename std::remove_pointer<T>::type> {};
857857

858858
template<
859859
typename T,
860-
std::enable_if_t<DetoursIsFunctionPointer<T>::value, int> = 0>
860+
typename std::enable_if<DetoursIsFunctionPointer<T>::value, int>::type = 0>
861861
LONG DetourAttach(_Inout_ T *ppPointer,
862862
_In_ T pDetour) noexcept
863863
{
@@ -868,7 +868,7 @@ LONG DetourAttach(_Inout_ T *ppPointer,
868868

869869
template<
870870
typename T,
871-
std::enable_if_t<DetoursIsFunctionPointer<T>::value, int> = 0>
871+
typename std::enable_if<DetoursIsFunctionPointer<T>::value, int>::type = 0>
872872
LONG DetourAttachEx(_Inout_ T *ppPointer,
873873
_In_ T pDetour,
874874
_Out_opt_ PDETOUR_TRAMPOLINE *ppRealTrampoline,
@@ -885,7 +885,7 @@ LONG DetourAttachEx(_Inout_ T *ppPointer,
885885

886886
template<
887887
typename T,
888-
std::enable_if_t<DetoursIsFunctionPointer<T>::value, int> = 0>
888+
typename std::enable_if<DetoursIsFunctionPointer<T>::value, int>::type = 0>
889889
LONG DetourDetach(_Inout_ T *ppPointer,
890890
_In_ T pDetour) noexcept
891891
{
@@ -894,7 +894,7 @@ LONG DetourDetach(_Inout_ T *ppPointer,
894894
reinterpret_cast<void*>(pDetour));
895895
}
896896

897-
#endif // __cplusplus >= 201402L || _MSVC_LANG >= 201402L
897+
#endif // __cplusplus >= 201103L || _MSVC_LANG >= 201103L
898898
//
899899
//////////////////////////////////////////////////////////////////////////////
900900

0 commit comments

Comments
 (0)