[C++-sig] A vector of objects with private == operators

Matthew Scouten matthew.scouten at gmail.com
Wed Mar 26 19:35:30 CET 2008


I have noticed that the vector indexing suite only compiles for a
vector<foo> if foo has an == operator. Some of the objects that I need to
wrap in a library have to wrap have no == operator. That's fine, I just
create a dummy operator as a global function. The dummy operator just tests
&a==&b.

Now I come to a problem. the 'bar' class has a == operator, but it is
declared private. I tried to create a global == operator but the compiler
complained that it was ambiguous (the compiler is such a whiny little
brat.)

So my questions are 3 fold,
Why the heck does  vector_indexing_suite need an == operator?
Assuming I can't change the problem class, what are possible workarounds?
Does vector_indexing_suite2 still need an == operator?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080326/0d57c8ba/attachment.htm>


More information about the Cplusplus-sig mailing list