summaryrefslogtreecommitdiff
path: root/smartptr.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-07-27 16:46:25 -0400
committerJeffrey Walton <noloader@gmail.com>2015-07-27 16:46:25 -0400
commit836cf237cf2e877e1841d69ade8248a9ddc54139 (patch)
tree643e558992050362066315ff280a1b5cb18de8bd /smartptr.h
parent25cc4c2db176543952c947dc82b34a94138e441e (diff)
downloadcryptopp-git-836cf237cf2e877e1841d69ade8248a9ddc54139.tar.gz
Fixed compile error due to MS using _MSC_VER rather than __cplusplus
Diffstat (limited to 'smartptr.h')
-rw-r--r--smartptr.h22
1 files changed, 20 insertions, 2 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 <algorithm>
-
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
{
public: