Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
operator==
Çağrılabilen nesnenin boş olup olmadığını sınar.
template <class Fty>
bool operator==(const function<Fty>& f, null_ptr_type npc);
template <class Fty>
bool operator==(null_ptr_type npc, const function<Fty>& f);
Parametreler
Fty
Kaydıracak işlev türü.
f
İşlev nesnesi
Npc
Null işaretçi.
Açıklamalar
İşleçler hem bir nesneye başvuru olan bir function bağımsız değişken hem de null işaretçi sabiti olan bir bağımsız değişken alır. Her ikisi de yalnızca nesne boşsa function true döndürür.
Örnek
// std__functional__operator_eq.cpp
// compile with: /EHsc
#include <functional>
#include <iostream>
int neg(int val)
{
return (-val);
}
int main()
{
std::function<int(int)> fn0;
std::cout << std::boolalpha << "empty == "
<< (fn0 == 0) << std::endl;
std::function<int(int)> fn1(neg);
std::cout << std::boolalpha << "empty == "
<< (fn1 == 0) << std::endl;
return (0);
}
empty == true
empty == false
operator!=
Çağrılabilen nesnenin boş olup olmadığını sınar.
template <class Fty>
bool operator!=(const function<Fty>& f, null_ptr_type npc);
template <class Fty>
bool operator!=(null_ptr_type npc, const function<Fty>& f);
Parametreler
Fty
Kaydıracak işlev türü.
f
İşlev nesnesi
Npc
Null işaretçi.
Açıklamalar
İşleçler hem bir nesneye başvuru olan bir function bağımsız değişken hem de null işaretçi sabiti olan bir bağımsız değişken alır. Her ikisi de yalnızca nesne boş değilse function true döndürür.
Örnek
// std__functional__operator_ne.cpp
// compile with: /EHsc
#include <functional>
#include <iostream>
int neg(int val)
{
return (-val);
}
int main()
{
std::function<int (int)> fn0;
std::cout << std::boolalpha << "not empty == "
<< (fn0 != 0) << std::endl;
std::function<int (int)> fn1(neg);
std::cout << std::boolalpha << "not empty == "
<< (fn1 != 0) << std::endl;
return (0);
}
not empty == false
not empty == true