functional (STL/CLR)

Dołącz nagłówek <cliext/functional> STL/CLR, aby zdefiniować szablony klas funkcjonalnych i powiązane delegaty i funkcje szablonu.

Składnia

#include <functional>

Wymagania

Header:<cliext/functional>

Obszaru nazw:cliext

Deklaracje

Delegat opis
binary_delegate (STL/CLR) Delegat dwóch argumentów.
binary_delegate_noreturn (STL/CLR) Dwu argument delegat zwraca wartość void.
unary_delegate (STL/CLR) Delegat z jednym argumentem.
unary_delegate_noreturn (STL/CLR) Delegat z jednym argumentem zwraca wartość void.
Klasa opis
binary_negate (STL/CLR) Functor negować dwu-argument functor.
binder1st (STL/CLR) Functor powiązać pierwszy argument z dwu argumentem functor.
binder2nd (STL/CLR) Functor do powiązania drugiego argumentu z dwu argumentem functor.
divides (STL/CLR) Podziel functor.
equal_to (STL/CLR) Równy functor porównania.
greater (STL/CLR) Większy functor porównania.
greater_equal (STL/CLR) Większe lub równe narzędzie functor porównania.
less (STL/CLR) Mniej functor porównania.
less_equal (STL/CLR) Mniej lub równy functor porównania.
logical_and (STL/CLR) Logiczny i funktor.
logical_not (STL/CLR) Logiczny nie functor.
logical_or (STL/CLR) Logiczny lub funktor.
minus (STL/CLR) Odejmij functor.
modulus (STL/CLR) Modulus functor.
multiplies (STL/CLR) Mnożenie functora.
negate (STL/CLR) Functor zwraca swój argument negowany.
not_equal_to (STL/CLR) Nie równa się functor porównania.
plus (STL/CLR) Dodaj functor.
unary_negate (STL/CLR) Functor negować jeden argument functor.
Function opis
bind1st (STL/CLR) Generuje binder1st dla argumentu i functor.
bind2nd (STL/CLR) Generuje element binder2nd dla argumentu i functor.
not1 (STL/CLR) Generuje unary_negate dla functora.
not2 (STL/CLR) Generuje binary_negate dla functora.

Członkowie

binary_delegate (STL/CLR)

Klasa ogólna opisuje delegata dwóch argumentów. Służy on do określania delegata pod względem argumentu i typów zwracanych.

Składnia

generic<typename Arg1,
    typename Arg2,
    typename Result>
    delegate Result binary_delegate(Arg1, Arg2);

Parametry

Arg1
Typ pierwszego argumentu.

Arg2
Typ drugiego argumentu.

Result
Zwracany typ.

Uwagi

Delegat ogólny opisuje funkcję dwóch argumentów.

W tych szablonach funkcji:

binary_delegate<int, int, int> Fun1;

binary_delegate<int, int, int> Fun2;

typy Fun1 i Fun2 są synonimami, natomiast dla:

delegate int Fun1(int, int);

delegate int Fun2(int, int);

nie są tego samego typu.

Przykład

// cliext_binary_delegate.cpp
// compile with: /clr
#include <cliext/functional>

bool key_compare(wchar_t left, wchar_t right)
    {
    return (left < right);
    }

typedef cliext::binary_delegate<wchar_t, wchar_t, bool> Mydelegate;
int main()
    {
    Mydelegate^ kcomp = gcnew Mydelegate(&key_compare);

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    System::Console::WriteLine();
    return (0);
    }
compare(L'a', L'a') = False
compare(L'a', L'b') = True
compare(L'b', L'a') = False

binary_delegate_noreturn (STL/CLR)

Klasa ogólna opisuje delegata dwóch argumentów, który zwraca wartość void. Służy on do określania delegata pod względem argumentu.

Składnia

generic<typename Arg1,
    typename Arg2>
    delegate void binary_delegate(Arg1, Arg2);

Parametry

Arg1
Typ pierwszego argumentu.

Arg2
Typ drugiego argumentu.

Uwagi

Delegat ogólny opisuje funkcję dwóch argumentów, która zwraca wartość void.

W tych szablonach funkcji:

binary_delegate_noreturn<int, int> Fun1;

binary_delegate_noreturn<int, int> Fun2;

typy Fun1 i Fun2 są synonimami, natomiast dla:

delegate void Fun1(int, int);

delegate void Fun2(int, int);

nie są tego samego typu.

Przykład

// cliext_binary_delegate_noreturn.cpp
// compile with: /clr
#include <cliext/functional>

void key_compare(wchar_t left, wchar_t right)
    {
    System::Console::WriteLine("compare({0}, {1}) = {2}",
        left, right, left < right);
    }

typedef cliext::binary_delegate_noreturn<wchar_t, wchar_t> Mydelegate;
int main()
    {
    Mydelegate^ kcomp = gcnew Mydelegate(&key_compare);

    kcomp(L'a', L'a');
    kcomp(L'a', L'b');
    kcomp(L'b', L'a');
    System::Console::WriteLine();
    return (0);
    }
compare(a, a) = False
compare(a, b) = True
compare(b, a) = False

binary_negate (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość logiczną NOT przechowywanego obiektu functor dwóch argumentów. Służy do określania obiektu funkcji pod względem jego przechowywanego functora.

Składnia

template<typename Fun>
    ref class binary_negate
    { // wrap operator()
public:
    typedef Fun stored_function_type;
    typedef typename Fun::first_argument_type first_argument_type;
    typedef typename Fun::second_argument_type second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    explicit binary_negate(Fun% functor);
    binary_negate(binary_negate<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Fun
Typ przechowywanego functora.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
stored_function_type Typ functora.
Element członkowski opis
binary_negate Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^() Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje functor z dwoma argumentami, który przechowuje kolejny functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca wartość logiczną NOT przechowywanego functora o nazwie z dwoma argumentami.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_binary_negate.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(3);
    Myvector c2;
    c2.push_back(4);
    c2.push_back(4);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 4 4"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::less<int> less_op;

    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(),
        cliext::binary_negate<cliext::less<int> >(less_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::not2(less_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
1 0
1 0

bind1st (STL/CLR)

Generuje element binder1st dla argumentu i functor.

Składnia

template<typename Fun,
    typename Arg>
    binder1st<Fun> bind1st(Fun% functor,
        Arg left);

Parametry szablonu

Arg
Typ argumentu.

Fun
Typ functora.

Parametry funkcji

functor
Functor owinąć.

left
Pierwszy argument do zawijania.

Uwagi

Szablon funkcji zwraca wartość binder1st<Fun>(functor, left). Używasz go jako wygodnego sposobu, aby zawinąć dwu argument functor i jego pierwszy argument w jednym argument functor, który wywołuje go z drugim argumentem.

Przykład

// cliext_bind1st.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(3);
    Myvector c3(2, 0);

// display initial contents " 4 3"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::minus<int> sub_op;
    cliext::binder1st<cliext::minus<int> > subfrom3(sub_op, 3);

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        subfrom3);
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        bind1st(sub_op, 3));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
-1 0
-1 0

bind2nd (STL/CLR)

Generuje element binder2nd dla argumentu i functor.

Składnia

template<typename Fun,
    typename Arg>
    binder2nd<Fun> bind2nd(Fun% functor,
        Arg right);

Parametry szablonu

Arg
Typ argumentu.

Fun
Typ functora.

Parametry funkcji

functor
Functor owinąć.

right
Drugi argument do opakowania.

Uwagi

Szablon funkcji zwraca wartość binder2nd<Fun>(functor, right). Używasz go jako wygodnego sposobu, aby opakowować dwu argument functor i jego drugi argument w jednym argument functor, który wywołuje go z pierwszym argumentem.

Przykład

// cliext_bind2nd.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(3);
    Myvector c3(2, 0);

// display initial contents " 4 3"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::minus<int> sub_op;
    cliext::binder2nd<cliext::minus<int> > sub4(sub_op, 4);

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        sub4);
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        bind2nd(sub_op, 4));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
0 -1
0 -1

binder1st (STL/CLR)

Klasa szablonu opisuje functor z jednym argumentem, który po wywołaniu zwraca przechowywany dwu argument functor o nazwie z przechowywanym pierwszym argumentem i podanym drugim argumentem. Służy do określania obiektu funkcji pod względem jego przechowywanego functora.

Składnia

template<typename Fun>
    ref class binder1st
    { // wrap operator()
public:
    typedef Fun stored_function_type;
    typedef typename Fun::first_argument_type first_argument_type;
    typedef typename Fun::second_argument_type second_argument_type;
    typedef typename Fun:result_type result_type;
    typedef Microsoft::VisualC::StlClr::UnaryDelegate<
        second_argument_type, result_type>
        delegate_type;

    binder1st(Fun% functor, first_argument_type left);
    binder1st(binder1st<Arg>% right);

    result_type operator()(second_argument_type right);
    operator delegate_type^();
    };

Parametry

Fun
Typ przechowywanego functora.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
stored_function_type Typ functora.
Element członkowski opis
binder1st Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^() Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje functor z jednym argumentem, który przechowuje dwu argument functor i pierwszy argument. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca wynik wywołania przechowywanego functor z przechowywanym pierwszym argumentem i podanym drugim argumentem.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_binder1st.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(3);
    Myvector c3(2, 0);

// display initial contents " 4 3"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::minus<int> sub_op;
    cliext::binder1st<cliext::minus<int> > subfrom3(sub_op, 3);

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        subfrom3);
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        bind1st(sub_op, 3));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
-1 0
-1 0

binder2nd (STL/CLR)

Klasa szablonu opisuje functor z jednym argumentem, który po wywołaniu zwraca przechowywany dwu argument functor o nazwie z podanym pierwszym argumentem i przechowywanym drugim argumentem. Służy do określania obiektu funkcji pod względem jego przechowywanego functora.

Składnia

template<typename Fun>
    ref class binder2nd
    { // wrap operator()
public:
    typedef Fun stored_function_type;
    typedef typename Fun::first_argument_type first_argument_type;
    typedef typename Fun::second_argument_type second_argument_type;
    typedef typename Fun:result_type result_type;
    typedef Microsoft::VisualC::StlClr::UnaryDelegate<
        first_argument_type, result_type>
        delegate_type;

    binder2nd(Fun% functor, second_argument_type left);
    binder2nd(binder2nd<Arg>% right);

    result_type operator()(first_argument_type right);
    operator delegate_type^();
    };

Parametry

Fun
Typ przechowywanego functora.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
stored_function_type Typ functora.
Element członkowski opis
binder2nd Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^() Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje element functor z jednym argumentem, który przechowuje dwu argument functor i drugi argument. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca wynik wywołania przechowywanego functor z podanym pierwszym argumentem i przechowywanym drugim argumentem.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_binder2nd.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(3);
    Myvector c3(2, 0);

// display initial contents " 4 3"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::minus<int> sub_op;
    cliext::binder2nd<cliext::minus<int> > sub4(sub_op, 4);

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        sub4);
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        bind2nd(sub_op, 4));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
0 -1
0 -1

divides (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca pierwszy argument podzielony przez drugi. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class divides
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    divides();
    divides(divides<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów i wartość zwracana.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
divides Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^() Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca pierwszy argument podzielony przez drugi.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_divides.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(3);
    Myvector c2;
    c2.push_back(2);
    c2.push_back(1);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 2 1"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::divides<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
2 1
2 3

equal_to (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy pierwszy argument jest równy drugiej. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class equal_to
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    equal_to();
    equal_to(equal_to<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
equal_to Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^() Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy pierwszy argument jest równy drugiemu.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_equal_to.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(3);
    Myvector c2;
    c2.push_back(4);
    c2.push_back(4);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 4 4"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::equal_to<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
1 0

greater (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy pierwszy argument jest większy niż drugi. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class greater
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    greater();
    greater(greater<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
greater Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy pierwszy argument jest większy niż drugi.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_greater.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(3);
    Myvector c2;
    c2.push_back(3);
    c2.push_back(3);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 3 3"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::greater<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
3 3
1 0

greater_equal (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy pierwszy argument jest większy lub równy drugiej. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class greater_equal
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    greater_equal();
    greater_equal(greater_equal<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
greater_equal Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy pierwszy argument jest większy lub równy drugiemu.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_greater_equal.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(3);
    Myvector c2;
    c2.push_back(4);
    c2.push_back(4);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 4 4"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::greater_equal<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
1 0

less (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy pierwszy argument jest mniejszy niż drugi. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class less
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    less();
    less(less<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
less Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy pierwszy argument jest mniejszy niż drugi.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_less.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(3);
    Myvector c2;
    c2.push_back(4);
    c2.push_back(4);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 4 4"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::less<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
0 1

less_equal (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy pierwszy argument jest mniejszy lub równy drugiej. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class less_equal
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    less_equal();
    less_equal(less_equal<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
less_equal Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy pierwszy argument jest mniejszy lub równy drugiemu.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_less_equal.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(3);
    Myvector c2;
    c2.push_back(3);
    c2.push_back(3);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 3 3"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::less_equal<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
3 3
0 1

logical_and (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy zarówno pierwszy argument, jak i drugi test mają wartość true. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class logical_and
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    logical_and();
    logical_and(logical_and<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
logical_and Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy zarówno pierwszy argument, jak i drugi test mają wartość true.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_logical_and.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(2);
    c1.push_back(0);
    Myvector c2;
    c2.push_back(3);
    c2.push_back(0);
    Myvector c3(2, 0);

// display initial contents " 1 0" and " 1 0"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::logical_and<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
2 0
3 0
1 0

logical_not (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy którykolwiek z argumentów testuje wartość false. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

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
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
argument_type Typ argumentu functor.
delegate_type Typ delegata ogólnego.
result_type Typ wyniku functor.
Element członkowski opis
logical_not Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje element functor z jednym argumentem. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy argument testuje wartość false.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

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);
    }
4 0
0 1

logical_or (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy pierwszy argument lub drugi test ma wartość true. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class logical_or
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    logical_or();
    logical_or(logical_or<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
logical_or Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy pierwszy argument lub drugi testuje jako true.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_logical_or.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(2);
    c1.push_back(0);
    Myvector c2;
    c2.push_back(0);
    c2.push_back(0);
    Myvector c3(2, 0);

// display initial contents " 2 0" and " 0 0"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::logical_or<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
2 0
0 0
1 0

minus (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca pierwszy argument minus drugi. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class minus
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    minus();
    minus(minus<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów i wartość zwracana.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
minus Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca pierwszy argument minus drugi.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_minus.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(3);
    Myvector c2;
    c2.push_back(2);
    c2.push_back(1);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 2 1"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::minus<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
2 1
2 2

modulus (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca pierwszy modulo argumentu drugiego. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class modulus
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    modulus();
    modulus(modulus<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów i wartość zwracana.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
modulus Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca pierwszy modulo argumentu drugi.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_modulus.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(2);
    Myvector c2;
    c2.push_back(3);
    c2.push_back(1);
    Myvector c3(2, 0);

// display initial contents " 4 2" and " 3 1"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::modulus<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 2
3 1
1 0

multiplies (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca pierwszy argument razy drugi. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class multiplies
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    multiplies();
    multiplies(multiplies<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów i wartość zwracana.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
multiplies Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca pierwszy argument razy drugi.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_multiplies.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(3);
    Myvector c2;
    c2.push_back(2);
    c2.push_back(1);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 2 1"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::multiplies<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
2 1
8 3

negate (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca argument negowany. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class negate
    { // wrap operator()
public:
    typedef Arg argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::UnaryDelegate<
        argument_type, result_type>
        delegate_type;

    negate();
    negate(negate<Arg>% right);

    result_type operator()(argument_type left);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
argument_type Typ argumentu functor.
delegate_type Typ delegata ogólnego.
result_type Typ wyniku functor.
Element członkowski opis
negate Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje element functor z jednym argumentem. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca jego argument negowany.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_negate.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(-3);
    Myvector c3(2, 0);

// display initial contents " 4 -3"
    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::negate<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 -3
-4 3

not_equal_to (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość true tylko wtedy, gdy pierwszy argument nie jest równy drugiej. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class not_equal_to
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    not_equal_to();
    not_equal_to(not_equal_to<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
not_equal_to Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca wartość true tylko wtedy, gdy pierwszy argument nie jest równy drugiemu.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_not_equal_to.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(3);
    Myvector c2;
    c2.push_back(4);
    c2.push_back(4);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 4 4"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::not_equal_to<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
0 1

not1 (STL/CLR)

Generuje element unary_negate dla elementu functor.

Składnia

template<typename Fun>
    unary_negate<Fun> not1(Fun% functor);

Parametry szablonu

Fun
Typ functora.

Parametry funkcji

functor
Functor owinąć.

Uwagi

Szablon funkcji zwraca wartość unary_negate<Fun>(functor). Używasz go jako wygodnego sposobu, aby opakowować functor jeden argument w functor, który dostarcza jego logiczne NOT.

Przykład

// cliext_not1.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::logical_not<int> not_op;

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        cliext::unary_negate<cliext::logical_not<int> >(not_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        cliext::not1(not_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 0
1 0
1 0

not2 (STL/CLR)

Generuje element binary_negate dla elementu functor.

Składnia

template<typename Fun>
    binary_negate<Fun> not2(Fun% functor);

Parametry szablonu

Fun
Typ functora.

Parametry funkcji

functor
Functor owinąć.

Uwagi

Szablon funkcji zwraca wartość binary_negate<Fun>(functor). Używasz go jako wygodnego sposobu, aby opakowować dwu argument functor w functor, który dostarcza jego logiczne NOT.

Przykład

// cliext_not2.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(3);
    Myvector c2;
    c2.push_back(4);
    c2.push_back(4);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 4 4"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::less<int> less_op;

    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(),
        cliext::binary_negate<cliext::less<int> >(less_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::not2(less_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
1 0
1 0

plus (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca pierwszy argument plus drugi. Służy do określania obiektu funkcji pod względem typu argumentu.

Składnia

template<typename Arg>
    ref class plus
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    plus();
    plus(plus<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

Parametry

Arg
Typ argumentów i wartość zwracana.

Funkcje elementów członkowskich

Definicja typu opis
delegate_type Typ delegata ogólnego.
first_argument_type Typ pierwszego argumentu functor.
result_type Typ wyniku functor.
second_argument_type Typ drugiego argumentu functor.
Element członkowski opis
plus Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
operator delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje klasę functor z dwoma argumentami. Definiuje operator operator() składowy, tak aby gdy obiekt jest wywoływany jako funkcja, zwraca pierwszy argument plus drugi.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_plus.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(3);
    Myvector c2;
    c2.push_back(2);
    c2.push_back(1);
    Myvector c3(2, 0);

// display initial contents " 4 3" and " 2 1"
    for each (int elem in c1)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

    for each (int elem in c2)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display
    cliext::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::plus<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
2 1
6 4

unary_delegate (STL/CLR)

Klasa ogólna opisuje delegata jednego argumentu. Służy on do określania delegata pod względem argumentu i typów zwracanych.

Składnia

generic<typename Arg,
    typename Result>
    delegate Result unary_delegate(Arg);

Parametry

Arg
Typ argumentu.

Result
Zwracany typ.

Uwagi

Delegat ogólny opisuje funkcję jednego argumentu.

W tych szablonach funkcji:

unary_delegate<int, int> Fun1;

unary_delegate<int, int> Fun2;

typy Fun1 i Fun2 są synonimami, natomiast dla:

delegate int Fun1(int);

delegate int Fun2(int);

nie są tego samego typu.

Przykład

// cliext_unary_delegate.cpp
// compile with: /clr
#include <cliext/functional>

int hash_val(wchar_t val)
    {
    return ((val * 17 + 31) % 67);
    }

typedef cliext::unary_delegate<wchar_t, int> Mydelegate;
int main()
    {
    Mydelegate^ myhash = gcnew Mydelegate(&hash_val);

    System::Console::WriteLine("hash(L'a') = {0}", myhash(L'a'));
    System::Console::WriteLine("hash(L'b') = {0}", myhash(L'b'));
    return (0);
    }
hash(L'a') = 5
hash(L'b') = 22

unary_delegate_noreturn (STL/CLR)

Klasa ogólna opisuje delegata z jednym argumentem, który zwraca wartość void. Służy on do określania delegata pod względem typu argumentu.

Składnia

generic<typename Arg>
    delegate void unary_delegate_noreturn(Arg);

Parametry

Arg
Typ argumentu.

Uwagi

Delegat ogólny opisuje funkcję jeden-argument, która zwraca wartość void.

W tych szablonach funkcji:

unary_delegate_noreturn<int> Fun1;

unary_delegate_noreturn<int> Fun2;

typy Fun1 i Fun2 są synonimami, natomiast dla:

delegate void Fun1(int);

delegate void Fun2(int);

nie są tego samego typu.

Przykład

// cliext_unary_delegate_noreturn.cpp
// compile with: /clr
#include <cliext/functional>

void hash_val(wchar_t val)
    {
    System::Console::WriteLine("hash({0}) = {1}",
       val, (val * 17 + 31) % 67);
    }

typedef cliext::unary_delegate_noreturn<wchar_t> Mydelegate;
int main()
    {
    Mydelegate^ myhash = gcnew Mydelegate(&hash_val);

    myhash(L'a');
    myhash(L'b');
    return (0);
    }
hash(a) = 5
hash(b) = 22

unary_negate (STL/CLR)

Klasa szablonu opisuje functor, który po wywołaniu zwraca wartość logiczną NOT przechowywanego elementu functor z jednym argumentem. Służy do określania obiektu funkcji pod względem jego przechowywanego functora.

Składnia

template<typename Fun>
    ref class unary_negate
    { // wrap operator()
public:
    typedef Fun stored_function_type;
    typedef typename Fun::argument_type argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::UnaryDelegate<
        argument_type, result_type>
        delegate_type;

    unary_negate(Fun% functor);
    unary_negate(unary_negate<Fun>% right);

    result_type operator()(argument_type left);
    operator delegate_type^();
    };

Parametry

Fun
Typ przechowywanego functora.

Funkcje elementów członkowskich

Definicja typu opis
argument_type Typ argumentu functor.
delegate_type Typ delegata ogólnego.
result_type Typ wyniku functor.
Element członkowski opis
unary_negate Konstruuje functor.
Operator opis
operator() Oblicza żądaną funkcję.
delegate_type^ Rzuca functor do delegata.

Uwagi

Klasa szablonu opisuje functor z jednym argumentem, który przechowuje inny argument functor. Definiuje operator operator() składowy, tak aby, gdy obiekt jest wywoływany jako funkcja, zwraca wartość logiczną NOT przechowywanego functora wywoływanego za pomocą argumentu.

Można również przekazać obiekt jako argument funkcji, którego typ jest delegate_type^ i zostanie odpowiednio przekonwertowany.

Przykład

// cliext_unary_negate.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::logical_not<int> not_op;

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        cliext::unary_negate<cliext::logical_not<int> >(not_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();

// transform and display with function
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        cliext::not1(not_op));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 0
1 0
1 0