[c++11] Enhanced ptr classes

This commit is contained in:
Alex Zolotarev 2014-08-06 22:53:58 +03:00 committed by Alex Zolotarev
parent b70d11daff
commit 180657e756
3 changed files with 32 additions and 1 deletions

View file

@ -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)
{

13
std/unique_ptr.hpp Normal file
View file

@ -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

View file

@ -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
#endif