共用方式為


ComPtrRef 類別

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

語法

template <typename T>
class ComPtrRef : public ComPtrRefBase<T>;

參數

T
ComPtr<T> 型別或衍生自它的型別,不只是 由 表示的ComPtr介面。

備註

表示 型 ComPtr<T>別 對象的參考。

成員

公用建構函式

名稱 描述
ComPtrRef::ComPtrRef 從指定的指標到另一個 ComPtrRef 物件,初始化 類別的新實例ComPtrRef

公用方法

名稱 描述
ComPtrRef::GetAddressOf 擷取目前 ComPtrRef 物件所表示之介面之指標的位址。
ComPtrRef::ReleaseAndGetAddressOf 刪除目前的 ComPtrRef 物件,並將指標傳回物件所表示之介面的 ComPtrRef 指標。

公用運算子

名稱 描述
ComPtrRef::operator InterfaceType** 刪除目前的 ComPtrRef 物件,並將指標傳回物件所表示之介面的 ComPtrRef 指標。
ComPtrRef::operator T* 傳回目前 ComPtrRef 物件ptr_數據成員的值
ComPtrRef::operator void** 刪除目前的 ComPtrRef 物件,將物件所 ComPtrRef 表示的指標轉換為指標, void然後傳回轉換指標。
ComPtrRef::operator* 擷取目前 ComPtrRef 物件所表示之介面的指標。
ComPtrRef::operator== 表示兩個 ComPtrRef 物件是否相等。
ComPtrRef::operator!= 表示兩個 ComPtrRef 物件是否不相等。

繼承階層架構

ComPtrRefBase

ComPtrRef

需求

標頭: client.h

命名空間: Microsoft::WRL::D etails

ComPtrRef::ComPtrRef

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

ComPtrRef(
   _In_opt_ T* ptr
);

參數

ptr
另一個 ComPtrRef 對象的基礎值。

備註

從指定的指標到另一個 ComPtrRef 物件,初始化 類別的新實例ComPtrRef

ComPtrRef::GetAddressOf

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

InterfaceType* const * GetAddressOf() const;

傳回值

目前 ComPtrRef 物件所表示之介面的指標位址。

備註

擷取目前 ComPtrRef 物件所表示之介面之指標的位址。

ComPtrRef::operator==

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

bool operator==(
   const Details::ComPtrRef<ComPtr<T>>& a,
   const Details::ComPtrRef<ComPtr<U>>& b
);

bool operator==(
   const Details::ComPtrRef<ComPtr<T>>& a,
   decltype(__nullptr)
);

bool operator==(
   decltype(__nullptr),
   const Details::ComPtrRef<ComPtr<T>>& a
);

bool operator==(
   const Details::ComPtrRef<ComPtr<T>>& a,
   void* b
);

bool operator==(
   void* b,
   const Details::ComPtrRef<ComPtr<T>>& a
);

參數

a
ComPtrRef 物件的參考。

b
另一個 ComPtrRef 對象的參考,或匿名型別的指標(void*)。

傳回值

如果物件 a 等於物件 b,則第一個運算子會產生 true ;否則false為 。

如果物件 a 等於 nullptr,則第二個和第三個運算符會產生 true ,否則為 false

如果物件 a 等於物件 b,則第四個和第五個運算子會產生 true ;否則為 false

備註

表示兩個 ComPtrRef 物件是否相等。

ComPtrRef::operator!=

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

bool operator!=(
   const Details::ComPtrRef<ComPtr<T>>& a,
   const Details::ComPtrRef<ComPtr<U>>& b
);

bool operator!=(
   const Details::ComPtrRef<ComPtr<T>>& a,
   decltype(__nullptr)
);

bool operator!=(
   decltype(__nullptr),
   const Details::ComPtrRef<ComPtr<T>>& a
);

bool operator!=(
   const Details::ComPtrRef<ComPtr<T>>& a,
   void* b
);

bool operator!=(
   void* b,
   const Details::ComPtrRef<ComPtr<T>>& a
);

參數

a
ComPtrRef 物件的參考。

b
另一個 ComPtrRef 對象的參考,或匿名物件的指標(void*)。

傳回值

如果物件 a 不等於物件 b,則第一個運算子會產生 true ,否則為 false

如果物件 a 不等於 nullptr,則第二個和第三個運算子會產生 true ,否則為 false

如果物件 a 不等於物件 b,則第四個和第五個運算符會產生 true ,否則為 false

備註

表示兩個 ComPtrRef 物件是否不相等。

ComPtrRef::operator InterfaceType**

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

operator InterfaceType**();

備註

刪除目前的 ComPtrRef 物件,並將指標傳回物件所表示之介面的 ComPtrRef 指標。

ComPtrRef::operator*

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

InterfaceType* operator *();

傳回值

目前物件所表示之介面的 ComPtrRef 指標。

備註

擷取目前 ComPtrRef 物件所表示之介面的指標。

ComPtrRef::operator T*

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

operator T*();

備註

傳回目前 ComPtrRef 物件ptr_數據成員的值

ComPtrRef::operator void**

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

operator void**() const;

備註

刪除目前的 ComPtrRef 物件,將物件所 ComPtrRef 表示的指標轉換為指標, void然後傳回轉換指標。

ComPtrRef::ReleaseAndGetAddressOf

支援 WRL 基礎結構,並不適合直接從您的程式代碼使用。

InterfaceType** ReleaseAndGetAddressOf();

傳回值

由已刪除 ComPtrRef 物件表示之介面的指標。

備註

刪除目前的 ComPtrRef 物件,並將指標傳回物件所表示之介面的 ComPtrRef 指標。