共用方式為


const_mem_fun_ref_t 類別

配接器類別,允許 const 使用參考引數初始化時,不接受任何引數作為一元函式物件的成員函式。 在 C++11 中已被取代,在 C++17 中移除。

語法

template <class Result, class Type>
    class const_mem_fun_ref_t
: public unary_function<Type, Result>
{
    explicit const_mem_fun_t(Result (Type::* Pm)() const);
    Result operator()(const Type& left) const;
};

參數

下午
要轉換成函式物件之 Type 類別的成員函式指標。

left
呼叫 Pm 成員函式的物件

傳回值

具適應性的一元函式。

備註

類別範本會將 Pm 本儲存在私用成員物件中,必須是 類別 Type 成員函式的指標。 它會將其成員函 operator() 式定義為傳回 ( left .* Pm )() const

範例

通常並不直接使用 const_mem_fun_ref_t 的建構函式,而協助程式函式 mem_fun_ref 可用來調整成員函式。 如需如何使用成員函式配接器的範例,請參閱 mem_fun_ref