This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/52309] New: [c++0x] unordered_set illegally requires value_type::operator!=


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52309

             Bug #: 52309
           Summary: [c++0x] unordered_set illegally requires
                    value_type::operator!=
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roman@binarylife.net


$ cat test.cpp 
#include <unordered_set>
struct value {};
struct hash { std::size_t operator()(value const&)const; };
bool operator==(value const&,value const&);
std::unordered_set<value,hash> set;
bool z=(set==set);

$ g++ -std=c++0x -c test.cpp 2>&1 | egrep error
...../include/c++/4.7.0/bits/hashtable_policy.h:1116:4: error: no match for
âoperator!=â in â__ity.std::__detail::_Node_const_iterator<_Value,
__constant_iterators, __cache>::operator*<value, true, true>() !=
__itx.std::__detail::_Node_const_iterator<_Value, __constant_iterators,
__cache>::operator*<value, true, true>()â

"set==set" needs operator!=(value,value).

The "value" type is EqualityComparable and looks good for unordered_set.
(17.6.3.1, 23.2.1, 23.2.5/2 and 23.2.5/11) 

All other associative unordered containers do not need
value_type::operator!=(). Only unordered_set requires it.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]