Dlaczego std :: sort ulegnie awarii, jeśli funkcja porównania nie jest operatorem <?

Poniższy program jest skompilowany z VC ++ 2012.

#include <algorithm>

struct A
{
    A()
        : a()
    {}

    bool operator <(const A& other) const
    {
        return a <= other.a;
    }

    int a;
};

int main()
{
    A coll[8];
    std::sort(&coll[0], &coll[8]); // Crash!!!
}

Jeśli się zmienięreturn a <= other.a; doreturn a < other.a; wtedy program działa zgodnie z oczekiwaniami bez wyjątku.

Czemu?

questionAnswers(2)

yourAnswerToTheQuestion