VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Platform/SharedPtr.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2020-06-26 01:18:40 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2020-06-26 01:22:18 +0200
commit5fb407cffebb8ec0cc50cb3e96e1bebf79ad1bc0 (patch)
treef621b8428b6390cb7f01d64fe72a7bd6ce400d9a /src/Platform/SharedPtr.h
parent4137c5e15bf3d784f3e6a84a1268f592910f9a67 (diff)
downloadVeraCrypt-5fb407cffebb8ec0cc50cb3e96e1bebf79ad1bc0.tar.gz
VeraCrypt-5fb407cffebb8ec0cc50cb3e96e1bebf79ad1bc0.zip
Linux/MacOSX: use standard std::shared_ptr instead of our custom implementation which is kept for compatibility with older compilers. We also introduce compatibility code for old compilers that don't define std::unique_ptr
Diffstat (limited to 'src/Platform/SharedPtr.h')
-rw-r--r--src/Platform/SharedPtr.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Platform/SharedPtr.h b/src/Platform/SharedPtr.h
index 7675c2a5..29669714 100644
--- a/src/Platform/SharedPtr.h
+++ b/src/Platform/SharedPtr.h
@@ -14,12 +14,25 @@
#define TC_HEADER_Platform_SharedPtr
#include <stdexcept>
+#include <memory>
#include "SharedVal.h"
#ifdef nullptr
namespace VeraCrypt
{
+#if (__cplusplus >= 201103L)
+ #define VC_USE_NATIVE_PTR 1
+#endif
+
+#ifdef VC_USE_NATIVE_PTR
+
+#define shared_ptr std::shared_ptr
+#define make_shared std::make_shared
+#define move_ptr std::move
+
+#else
+
template <class T>
class SharedPtr
{
@@ -157,6 +170,10 @@ namespace VeraCrypt
#define make_shared VeraCrypt::make_shared
+#define unique_ptr auto_ptr
+#define move_ptr(p) p
+
+#endif
}
#endif // nullptr