Boost logo

Boost :

From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2002-09-16 04:02:36


I was testing the interactions between the Interval library and the
Rational library. And I did encounter a small problem on such a code:

  typedef rational<something> R;
  typedef interval<R> I;

  I a; R b;
  I c = a / b;

Here the compiler complains about ambiguous operators:

  'operator/ (const I&, const R&)' defined in rational.hpp
  'operator/ (const I&, const R&)' defined in interval.hpp

The compiler sees an ambiguity since rational.hpp defines 'operator/' by:

  template <typename IntType, typename T>
  operator/ (const T& i, const rational<IntType>& r);

And I think it's wrong (just look at the return type). The first argument
shouldn't be of type 'T' but of type 'IntType' or 'rational<IntType>'.



Boost list run by bdawes at, gregod at, cpdaniel at, john at