[circular_buffer] comparison operators

Hi, I was browsing the docs for the upcoming circular_buffer component and noticed that the declaration of the comparison operators use the following, "traditional" style. template <class T, class Alloc> bool operator< (const circular_buffer<T,Alloc>& lhs, const circular_buffer<T,Alloc>& rhs); I think they should be templatized on both the lhs And rhs, like so: template <class T0, class Alloc0, class T1, class Alloc1> bool operator< (const circular_buffer<T0,Alloc0>& lhs, const circular_buffer<T1,Alloc1>& rhs); Not earth-shattering perhaps, but still a nice flexibility improvement IMHO. This scheme is used by several other boost components like for ex multi-index. Regards // Fredrik Blomqvist

"Fredrik Blomqvist" wrote:
I was browsing the docs for the upcoming circular_buffer component and noticed that the declaration of the comparison operators use the following, "traditional" style.
template <class T, class Alloc> bool operator< (const circular_buffer<T,Alloc>& lhs, const circular_buffer<T,Alloc>& rhs);
I think they should be templatized on both the lhs And rhs, like so:
template <class T0, class Alloc0, class T1, class Alloc1> bool operator< (const circular_buffer<T0,Alloc0>& lhs, const circular_buffer<T1,Alloc1>& rhs);
Not earth-shattering perhaps, but still a nice flexibility improvement IMHO. This scheme is used by several other boost components like for ex multi-index.
I remember this was suggested during review but perhaps an common consensus on this should be formed first. /Pavel

Pavel Vozenilek wrote:
"Fredrik Blomqvist" wrote:
I was browsing the docs for the upcoming circular_buffer component and noticed that the declaration of the comparison operators use the following, "traditional" style.
template <class T, class Alloc> bool operator< (const circular_buffer<T,Alloc>& lhs, const circular_buffer<T,Alloc>& rhs);
I think they should be templatized on both the lhs And rhs, like so:
template <class T0, class Alloc0, class T1, class Alloc1> bool operator< (const circular_buffer<T0,Alloc0>& lhs, const circular_buffer<T1,Alloc1>& rhs);
Not earth-shattering perhaps, but still a nice flexibility improvement IMHO. This scheme is used by several other boost components like for ex multi-index.
I remember this was suggested during review but perhaps an common consensus on this should be formed first. Yes that makes sense. Personally I see mostly benefits and I think it's nice to allow the contained elements to decide on compatibility. A good example could be the Iterator facade.
Regards // Fredrik Blomqvist
participants (2)
-
Fredrik Blomqvist
-
Pavel Vozenilek