RE: [boost] Formal Review: Circular Buffer

Shouldn't the comparison functions allow the types to differ? I mean don't they still lexigraphically compare as long as there is a comparison function F that a F b for each element exists circular_buffer<T, MyAlloc> x; circular_buffer<S, YourAlloc> y; bool b = x == y; for where the operator T == S is valid? And what does the allocator have to do with it? Therefore IMO, all of the comparison functions should change from template< typename T, typename Alloc> bool operator F ( circular_buffer<T, Alloc> &lhs, circular_buffer<T, Alloc> &rhs); to template< typename T1, typename Alloc1, typename T2, typename Alloc2> bool operator F ( circular_buffer<T1, Alloc1> &lhs, circular_buffer<T2, Alloc2> &rhs); Yours, -Gary- powellg@amazon.com

"Powell, Gary" <powellg@amazon.com> wrote
Shouldn't the comparison functions allow the types to differ?
circular_buffer<T, MyAlloc> x; circular_buffer<S, YourAlloc> y;
bool b = x == y; for where the operator T == S is valid? And what does the allocator have to do with it?
Hmm, do you know a STL implementation/some container with this feature? It may be often bug to compare containers with different types. /Pavel
participants (2)
-
Pavel Vozenilek
-
Powell, Gary