libcopp  1.1.0
smart_ptr.h
Go to the documentation of this file.
1 
15 #ifndef STD_SMARTPTR_H
16 #define STD_SMARTPTR_H
17 
18 #pragma once
19 
20 // ============================================================
21 // 公共包含部分
22 // 自动导入TR1库
23 // ============================================================
24 
36 #if defined(_MSC_VER) && _MSC_VER >= 1500
37 #include <memory>
38 #endif
39 
40 // VC9.0 SP1以上分支判断
41 #if defined(_MSC_VER) && ((_MSC_VER == 1500 && defined(_HAS_TR1)) || _MSC_VER > 1500)
42 // 采用VC std::tr1库
43 #include <memory>
44 #elif defined(__clang__) && __clang_major__ >= 3
45 // 采用Clang c++11库
46 #include <memory>
47 #elif defined(__GNUC__) && __GNUC__ >= 4
48 // 采用G++ std::tr1库
49 #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
50 #include <memory>
51 #else
52 #include <tr1/memory>
53 namespace std {
54  using tr1::bad_weak_ptr;
55  using tr1::const_pointer_cast;
56  using tr1::dynamic_pointer_cast;
57  using tr1::enable_shared_from_this;
58  using tr1::get_deleter;
59  using tr1::shared_ptr;
60  using tr1::make_shared;
61  using tr1::static_pointer_cast;
62  using tr1::swap;
63  using tr1::weak_ptr;
64  using tr1::unique_ptr;
65 }
66 #endif
67 #else
68 // 采用boost tr1库
69 #include <boost/tr1/memory.hpp>
70 namespace std {
71  using tr1::bad_weak_ptr;
72  using tr1::const_pointer_cast;
73  using tr1::dynamic_pointer_cast;
74  using tr1::enable_shared_from_this;
75  using tr1::get_deleter;
76  using tr1::shared_ptr;
77  using tr1::make_shared;
78  using tr1::static_pointer_cast;
79  using tr1::swap;
80  using tr1::weak_ptr;
81  using tr1::unique_ptr;
82 }
83 #endif
84 
85 #include "intrusive_ptr.h"
86 
87 #endif
侵入式智能指针
STL namespace.