logical_not (STL/CLR)
Teoria zawiera opis szablonu klasy, że po wywołaniu, zwraca wartość true tylko wtedy, gdy albo argument testy jako FAŁSZ.Umożliwia ona określić obiekt funkcji pod względem jego typ argumentu.
template<typename Arg>
ref class logical_not
{ // wrap operator()
public:
typedef Arg argument_type;
typedef bool result_type;
typedef Microsoft::VisualC::StlClr::UnaryDelegate<
argument_type, result_type>
delegate_type;
logical_not();
logical_not(logical_not<Arg> %right);
result_type operator()(argument_type left);
operator delegate_type^();
};
Parametry
- ARG
Typy argumentów.
Funkcje członkowskie
Definicja typu |
Opis |
---|---|
argument_type |
Typ argumentu teoria. |
delegate_type |
Typ rodzajowy delegata. |
Typ_wyniku |
Typ wyniku teoria. |
Członek |
Opis |
---|---|
logical_not |
Konstrukcje teoria. |
Operator |
Opis |
---|---|
Operator() |
Oblicza odpowiednią funkcję. |
Operator delegate_type ^ |
Posługując się miarką teoria pełnomocnikowi. |
Uwagi
Klasa szablon opisuje teoria jeden argument.Definiuje operator Państwa operator() tak, że gdy obiekt jest wywoływana w funkcji, to zwraca wartość true tylko jeżeli argument badań jako FAŁSZ.
Można również przekazać obiekt jako argument funkcji, których typ jest delegate_type^ i odpowiednio go będą konwertowane.
Przykład
// cliext_logical_not.cpp
// compile with: /clr
#include <cliext/algorithm>
#include <cliext/functional>
#include <cliext/vector>
typedef cliext::vector<int> Myvector;
int main()
{
Myvector c1;
c1.push_back(4);
c1.push_back(0);
Myvector c3(2, 0);
// display initial contents " 4 0"
for each (int elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// transform and display
cliext::transform(c1.begin(), c1.begin() + 2,
c3.begin(), cliext::logical_not<int>());
for each (int elem in c3)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
Wymagania
Nagłówek:<cliext/funkcjonalności>
Przestrzeń nazw: cliext