// 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 );
};
宣言:
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 に変換します。
template<typename T>
struct ptr
{
- typedef boost::shared_ptr<T> type;
+ typedef shared_ptr<T> type;
};
template<typename T>
namespace gintenlib
{
- // new_ の戻り値のポインタ型(現在は boost::shared_ptr 一択)
+ // new_ の戻り値のポインタ型(現在は shared_ptr 一択)
template<typename T>
struct ptr
{
// 本体は別の名前空間を使う
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()
// 「任意ポインタの変換」本体
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 );
}
{
// これも薄いラッパ
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 );
}
// std::auto_ptr version
+ // 実際のところ必要ないけど
template<typename T>
inline shared_ptr<T> to_shared( std::auto_ptr<T> pt )
{