2011-02-26 03:52:54 +00:00
|
|
|
|
2011-03-14 22:17:49 +00:00
|
|
|
#ifndef __COMMON_SMART_POINTERS_H__
|
|
|
|
#define __COMMON_SMART_POINTERS_H__
|
2011-02-26 03:52:54 +00:00
|
|
|
|
2016-08-15 16:29:06 +00:00
|
|
|
#if 1
|
2011-02-26 03:52:54 +00:00
|
|
|
//C++0x
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
#define SHARED_PTR(T) std::shared_ptr<T>
|
|
|
|
#define WEAK_PTR(T) std::weak_ptr<T>
|
|
|
|
|
|
|
|
#define MAKE_SHARED(T, ...) std::make_shared<T>(__VA_ARGS__)
|
|
|
|
#define ENABLE_SHARED_FROM_THIS(T) std::enable_shared_from_this<T>
|
|
|
|
|
|
|
|
#define STATIC_POINTER_CAST(T, ARG) std::static_pointer_cast<T>(ARG)
|
|
|
|
#define DYNAMIC_POINTER_CAST(T, ARG) std::dynamic_pointer_cast<T>(ARG)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// tr1
|
|
|
|
#include <tr1/memory>
|
|
|
|
|
|
|
|
#define SHARED_PTR(T) std::tr1::shared_ptr<T>
|
|
|
|
#define WEAK_PTR(T) std::tr1::weak_ptr<T>
|
|
|
|
|
|
|
|
#define MAKE_SHARED(T, ...) std::tr1::shared_ptr<T>(new T(__VA_ARGS__))
|
|
|
|
#define ENABLE_SHARED_FROM_THIS(T) std::tr1::enable_shared_from_this<T>
|
|
|
|
|
|
|
|
#define STATIC_POINTER_CAST(T, ARG) std::tr1::static_pointer_cast<T>(ARG)
|
|
|
|
#define DYNAMIC_POINTER_CAST(T, ARG) std::tr1::dynamic_pointer_cast<T>(ARG)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|