how Bindungsfunktion funktioniert für funktionale Objekte in c ++

Ich bin auf die folgende Funktion find_if gestoßen.

find_if (coll.begin(), coll.end(), 
             bind(logical_and<bool>(), 
                  bind(greater<int>(),_1,x), bind(less<int>(),_1,y)
                 )
         );

Ich habe den Zweifel, dass wie die Bind (größer (), _ 1, x) und Bind (weniger (), _ 1, y) ausgewertet werden und dort bool-Werte zurückgeben? Dies funktioniert ansonsten nicht wie unten gezeigt.

#include <iostream>
#include <functional>

int main()
{
    using namespace std::placeholders;

    //auto fn = std::bind(std::greater<int>(), 5, _1);
    //std::cout << fn(7) << std::endl;
    //std::cout << typeid(fn).name() << std::endl;

    auto fn1 = std::bind(std::greater<int>(),5,6);
    auto fn2 = std::bind(std::less<int>(),7,5);

    std::cout << std::bind( std::logical_and<bool>(), fn1, fn2 )(); // how this works??
    std::cout << std::logical_and<bool>()(fn1, fn2)();  // Compilation error
}

Wirklich neugierig, wie die Funktoren in der Bindefunktion aufgerufen werden. Kann mir bitte jemand erklären, wie das geht? Danke im Voraus

Antworten auf die Frage(2)

Ihre Antwort auf die Frage