Fixed compile error due to MS using _MSC_VER rather than __cplusplus

pull/35/head
Jeffrey Walton 2015-07-27 16:46:25 -04:00
parent 25cc4c2db1
commit 836cf237cf
2 changed files with 23 additions and 3 deletions

View File

@ -2,12 +2,30 @@
#define CRYPTOPP_SMARTPTR_H #define CRYPTOPP_SMARTPTR_H
#include "config.h" #include "config.h"
#include "stdcpp.h"
#include "trap.h" #include "trap.h"
#include <algorithm>
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// This must be kept in sync with stdcpp.h because <memory> is included based on the same logic.
#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1600)) && !defined(__clang__)
# include <memory>
template<typename T>
using auto_ptr = std::unique_ptr<T>;
#elif defined(__clang__)
# if (__has_include(<tr1/memory>))
# include <tr1/memory>
using std::auto_ptr;
# endif
#elif (__cplusplus < 201103L)
# include <tr1/memory>
using std::auto_ptr;
#else
# include <memory>
template<typename T>
using auto_ptr = std::unique_ptr<T>;
#endif
template <class T> class simple_ptr template <class T> class simple_ptr
{ {
public: public:

View File

@ -16,7 +16,9 @@
// <memory>, auto_ptr and unique_ptr. Apple's built-in Clang behaves // <memory>, 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 // 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). // __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 <memory> # include <memory>
#elif defined(__clang__) #elif defined(__clang__)
# if (__has_include(<tr1/memory>)) # if (__has_include(<tr1/memory>))