From 836cf237cf2e877e1841d69ade8248a9ddc54139 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 27 Jul 2015 16:46:25 -0400 Subject: [PATCH] Fixed compile error due to MS using _MSC_VER rather than __cplusplus --- smartptr.h | 22 ++++++++++++++++++++-- stdcpp.h | 4 +++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/smartptr.h b/smartptr.h index daa53255..0ec83be2 100644 --- a/smartptr.h +++ b/smartptr.h @@ -2,12 +2,30 @@ #define CRYPTOPP_SMARTPTR_H #include "config.h" +#include "stdcpp.h" #include "trap.h" -#include - NAMESPACE_BEGIN(CryptoPP) +// This must be kept in sync with stdcpp.h because is included based on the same logic. +#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1600)) && !defined(__clang__) +# include + template + using auto_ptr = std::unique_ptr; +#elif defined(__clang__) +# if (__has_include()) +# include + using std::auto_ptr; +# endif +#elif (__cplusplus < 201103L) +# include + using std::auto_ptr; +#else +# include + template + using auto_ptr = std::unique_ptr; +#endif + template class simple_ptr { public: diff --git a/stdcpp.h b/stdcpp.h index ec904765..851a1d32 100644 --- a/stdcpp.h +++ b/stdcpp.h @@ -16,7 +16,9 @@ // , auto_ptr and unique_ptr. Apple's built-in Clang behaves // differently than a LLVM downloaded and compiled CLang. So we fall back to Clang's // __has_include (http://clang.llvm.org/docs/LanguageExtensions.html#id3). -#if (__cplusplus >= 201103L) && !defined(__clang__) +// This must be kept in sync with smartptr.h because auto_ptr and unique_ptr are +// brought in based on the same logic. +#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1600)) && !defined(__clang__) # include #elif defined(__clang__) # if (__has_include())