const_mem_fun_t 類別
配接器類別,這個類別允許不接受引數的常數成員函式在使用參考引數初始化時,可當做一元函式物件來呼叫。 在 C++11 中已被取代,在 C++17 中移除。
語法
template <class Result, class Type>
class const_mem_fun_t : public unary_function <Type *, Result>
{
explicit const_mem_fun_t(Result (Type::* Pm)() const);
Result operator()(const Type* Pleft) const;
};
參數
下午
要轉換成函式物件之 Type
類別的成員函式指標。
Pleft
呼叫 Pm 成員函式的物件 。
傳回值
具適應性的一元函式。
備註
類別範本會將 Pm 複 本儲存在私用成員物件中,必須是 類別 Type
成員函式的指標。 它會將其成員函 operator()
式定義為傳回 ( Pleft
- > * Pm
)() const
。
範例
通常並不直接使用 const_mem_fun_t
的建構函式,而協助程式函式 mem_fun
可用來調整成員函式。 如需如何使用成員函式配接器的範例,請參閱 mem_fun。
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應