|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-01-23 09:28:03
From: "Paul Moore" <gustav_at_[hidden]>
> On 22 Jan 2001, at 16:44, Moore, Paul wrote:
>
> > Well, it's partly me. I should have realised that param_type would be
> > non-deducible. On the other hand, replacing that with a simple IntType
still
> > gives the error. It looks like MSVC is deducing IntType from the first
> > argument, and then complaining about the second, instead of having
another
> > go by deducing based on the second argument, and then applying
conversions
> > to make the first work.
>
> This fails on gcc (mingw) and Borland C++ as well. Are all of these
> broken?
You mean the version with the IntType first parameter? No, they are right.
IntType must be deduced identically in the two contexts for the template to
be considered a candidate.
The original version should work with gcc/bcc, however. It's only MSVC that
erroneosly overdeduces. :-)
On MSVC the best workaround I've come up with is to add an additional
template parameter:
template<class IntType, class IntType2> void f(IntType1,
rational<IntType2>);
This declaration doesn't ensure that IntType is convertible to IntType2, but
the definition should catch this case.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk