|
Boost : |
From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2002-09-12 09:42:28
On Fri, 6 Sep 2002, Douglas Gregor wrote:
> template<typename T> struct interval_holder;
>
> template<typename T>
> class interval {
> public:
> bool operator<(const interval_holder<T>& other) const
> {
> std::cout << "Default implementation\n";
> return true;
> }
> };
>
> template<typename T>
> struct interval_holder
> {
> interval_holder(const interval<T>& in_interval) : interval_(in_interval) {}
>
> const interval<T>& interval_;
> };
>
> namespace my_interval_semantics {
> template<typename T>
> bool operator<(const interval<T>& x, const interval<T>& y)
> {
> std::cout << "my_interval_semantics implementation\n";
> return false;
> }
> };
I gave it a try; and after having suffered a lot (mainly because your code
doesn't take into account the other template parameter), I was finally
able to adapt your code to the library and it seems to work.
However, I did encounter a serious problem. I'm unable to define the
default operators with these parameters: '(const T&, const
interval<T,_>&)'. Does anyone know how to get back the mixed comparison
operators when the base type is at the left?
Or maybe nobody does care if these operators are forsaken?
Thanks,
Guillaume
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk