Lumino
ln::Ref< T > Class Template Reference

RefObject 用 スマートポインタ More...

#include <RefObject.hpp>

Public Member Functions

constexpr Ref () noexcept
 参照を持たない空の Ref を構築します。
 
constexpr Ref (std::nullptr_t) noexcept
 参照を持たない空の Ref を構築します。
 
 Ref (T *ptr)
 生ポインタの所有権を受け取ります。
 
 Ref (T *ptr, bool retain)
 生ポインタの所有権を受け取ります。retain が false の場合、参照カウントをインクリメントせずに参照します。
 
 Ref (const Ref &ref) noexcept
 他の Ref と、参照を共有します。(コピーコンストラクタ)
 
template<class Y >
 Ref (const Ref< Y > &ref) noexcept
 他の Ref と、参照を共有します。
 
 Ref (Ref &&ref) noexcept
 他の Ref から参照をムーブします。
 
template<class Y >
 Ref (Ref< Y > &&ref) noexcept
 他の Ref から参照をムーブします。
 
 ~Ref ()
 保持しているオブジェクトの参照を開放します。
 
void reset (T *ptr, bool retain=true)
 保持しているオブジェクトの所有権を放棄し、指定されたオブジェクトの参照を設定します。 More...
 
void reset ()
 保持しているオブジェクトの参照を放棄します。
 
void swap (Ref< T > &other)
 2つの Ref オブジェクトを入れ替えます。
 
T * detach ()
 保持しているオブジェクトの参照を放棄します。参照カウントはデクリメントしません。
 
T * get () const
 保持しているオブジェクトへのポインタを取得します。
 
Refoperator= (const Ref &ref) noexcept
 保持しているオブジェクトの所有権を放棄し、他の Ref が持つ参照を共有します。
 
template<class Y >
Refoperator= (const Ref< Y > &ref) noexcept
 保持しているオブジェクトの所有権を放棄し、他の Ref が持つ参照を共有します。
 
Refoperator= (Ref &&ref) noexcept
 保持しているオブジェクトの所有権を放棄し、他の Ref が持つをムーブします。
 
template<class Y >
Refoperator= (Ref< Y > &&ref) noexcept
 保持しているオブジェクトの所有権を放棄し、他の Ref が持つをムーブします。
 
T & operator* () const noexcept
 ポインタを間接参照します。
 
T * operator-> () const noexcept
 ポインタを通してオブジェクトにアクセスします。
 
 operator bool () const noexcept
 有効なポインタを保持しているかを確認します。
 
 operator T* () const
 オブジェクトのポインタへの変換をサポートします。
 

Static Public Attributes

static const Ref< T > Null
 null 値を表します。
 

Detailed Description

template<class T>
class ln::Ref< T >

RefObject 用 スマートポインタ

Member Function Documentation

◆ reset()

template<class T>
void ln::Ref< T >::reset ( T *  ptr,
bool  retain = true 
)

保持しているオブジェクトの所有権を放棄し、指定されたオブジェクトの参照を設定します。

Parameters
[in]ptr: 管理対象としてセットするオブジェクト
[in]retain: 参照カウントをインクリメントするかどうか。false の場合、参照カウントをインクリメントせずに参照します。

The documentation for this class was generated from the following file: