OSDN Git Service

shared_ptr 関連で微更新
authorSubaruG <subaru_g@users.sourceforge.jp>
Fri, 22 Jan 2010 17:39:34 +0000 (02:39 +0900)
committerSubaruG <subaru_g@users.sourceforge.jp>
Fri, 22 Jan 2010 17:39:34 +0000 (02:39 +0900)
gintenlib/clonable_ptr.hpp
gintenlib/intrusive_to_shared.hpp
gintenlib/new_.hpp
gintenlib/to_shared.hpp

index 7dca567..54116d7 100644 (file)
@@ -66,9 +66,9 @@
       // unique でなければ参照するオブジェクトを複製して unique にする
       void to_unique();
       
-      // boost::shared_ptr への変換
-      boost::shared_ptr<T> to_shared() const;
-      friend boost::shared_ptr<T> to_shared( const clonable_ptr& target );
+      // shared_ptr への変換
+      shared_ptr<T> to_shared() const;
+      friend shared_ptr<T> to_shared( const clonable_ptr& target );
       
     
     };
index d1af0c1..e5e1ca1 100644 (file)
@@ -9,13 +9,13 @@
 
   宣言:
     template<typename T>
-    boost::shared_ptr<T> intrusive_to_shared( const boost::intrusive_ptr<T>& p );
+    shared_ptr<T> intrusive_to_shared( const boost::intrusive_ptr<T>& p );
     
     template<typename T>
-    boost::shared_ptr<T> intrusive_to_shared( T* p, bool add_ref = true );
+    shared_ptr<T> intrusive_to_shared( T* p, bool add_ref = true );
     
     template<typename T>
-    boost::shared_ptr<T> to_shared( const boost::intrusive_ptr<T>& p );
+    shared_ptr<T> to_shared( const boost::intrusive_ptr<T>& p );
 
   機能:
     intrusive_ptr を shared_ptr に変換します。
index 9e7a789..5471afc 100644 (file)
@@ -11,7 +11,7 @@
     template<typename T>
     struct ptr
     {
-      typedef boost::shared_ptr<T> type;
+      typedef shared_ptr<T> type;
     };
     
     template<typename T>
@@ -72,7 +72,7 @@
 
 namespace gintenlib
 {
-  // new_ の戻り値のポインタ型(現在は boost::shared_ptr 一択)
+  // new_ の戻り値のポインタ型(現在は shared_ptr 一択)
   template<typename T>
   struct ptr
   {
index 065e622..8a3d1de 100644 (file)
 // 本体は別の名前空間を使う
 namespace gintenlib_to_shared_impl_
 {
+  using gintenlib::shared_ptr;
+  
   // いわゆる「スマートポインタ」を保持するホルダ
   // shared_ptr のコンストラクタの第二引数として渡す削除子として使える
   template<typename Pointer>
   struct to_shared_holder
   {
     typedef typename Pointer::element_type T;
-    typedef boost::shared_ptr<T> shared_t;
+    typedef shared_ptr<T> shared_t;
     
     // 構築
     to_shared_holder()
@@ -129,7 +131,7 @@ namespace gintenlib_to_shared_impl_
   
   // 「任意ポインタの変換」本体
   template<typename P>
-  inline boost::shared_ptr<typename P::element_type> to_shared( const P& pt )
+  inline shared_ptr<typename P::element_type> to_shared( const P& pt )
   {
     return to_shared_holder<P>::to_shared( pt );
   }
@@ -142,7 +144,7 @@ namespace gintenlib_to_shared_impl
 {
   // これも薄いラッパ
   template<typename P>
-  inline boost::shared_ptr<typename P::element_type> to_shared_impl( const P& pt )
+  inline gintenlib::shared_ptr<typename P::element_type> to_shared_impl( const P& pt )
   {
     using namespace gintenlib_to_shared_impl_;
     return to_shared( pt );
@@ -161,6 +163,7 @@ namespace gintenlib
   }
   
   // std::auto_ptr version
+  // 実際のところ必要ないけど
   template<typename T>
   inline shared_ptr<T> to_shared( std::auto_ptr<T> pt )
   {