According to the standard ยง25.2.8, std::unique has behavior defined in terms of
*i == *(i - 1) or pred(*i, *(i - 1)) != false however the current implementation compares each successive element to the first in the "equal" range. This is only equivalent if the transitive property holds. This is certainly wrong if a functor is passed, and it may be wrong for the other case as well. The non-functor version is defined to evaluate *i == *(i - 1) but does not require EqualityComparable elements. C++0x does impose this requirement: "The comparison function shall be an equivalence relation." -- Summary: std::unique incorrectly assumes transitive property on functor, operator== Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: potswa at mac dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43595