[Bug libstdc++/43595] New: std::unique incorrectly assumes transitive property on functor, operator==
potswa at mac dot com
gcc-bugzilla@gcc.gnu.org
Wed Mar 31 04:29:00 GMT 2010
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
More information about the Gcc-bugs
mailing list