diff options
author | Alex Zolotarev <alex@mapswithme.com> | 2014-08-06 23:53:58 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:25:03 +0300 |
commit | 180657e756fefbe5d601c64b860ee470217b4956 (patch) | |
tree | 80f12150fc9a6c3101dc0ad71e7e25108ea940ff /std | |
parent | b70d11daffeede8c6cb8baaa192344d662a5c266 (diff) |
[c++11] Enhanced ptr classes
Diffstat (limited to 'std')
-rw-r--r-- | std/shared_ptr.hpp | 9 | ||||
-rw-r--r-- | std/unique_ptr.hpp | 13 | ||||
-rw-r--r-- | std/weak_ptr.hpp | 11 |
3 files changed, 32 insertions, 1 deletions
diff --git a/std/shared_ptr.hpp b/std/shared_ptr.hpp index 23b69a1921..9d08b751a0 100644 --- a/std/shared_ptr.hpp +++ b/std/shared_ptr.hpp @@ -5,11 +5,20 @@ #undef new #endif +#if __cplusplus > 199711L + +#include <memory> +using std::shared_ptr; + +#else + #include <boost/shared_ptr.hpp> using boost::shared_ptr; using boost::static_pointer_cast; +#endif + template <typename T> inline shared_ptr<T> make_shared_ptr(T * t) { diff --git a/std/unique_ptr.hpp b/std/unique_ptr.hpp new file mode 100644 index 0000000000..e0f9f2e16b --- /dev/null +++ b/std/unique_ptr.hpp @@ -0,0 +1,13 @@ +#pragma once +#include "common_defines.hpp" + +#ifdef new +#undef new +#endif + +#include <memory> +using std::unique_ptr; + +#ifdef DEBUG_NEW +#define new DEBUG_NEW +#endif diff --git a/std/weak_ptr.hpp b/std/weak_ptr.hpp index 7539859a72..ac9f183e07 100644 --- a/std/weak_ptr.hpp +++ b/std/weak_ptr.hpp @@ -5,9 +5,18 @@ #undef new #endif +#if __cplusplus > 199711L + +#include <memory> +using std::weak_ptr; + +#else + #include <boost/weak_ptr.hpp> using boost::weak_ptr; +#endif + #ifdef DEBUG_NEW #define new DEBUG_NEW -#endif
\ No newline at end of file +#endif |