Boost logo

Boost :

From: Moore, Paul (paul.moore_at_[hidden])
Date: 2001-01-23 10:27:00


From: Peter Dimov [mailto:pdimov_at_[hidden]]
> > 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.

OK, I follow now. This stuff makes my head hurt :-)

> The original version should work with gcc/bcc, however.
> It's only MSVC that erroneosly overdeduces. :-)

I *thought* that version failed when I tried it last night. I'll have
another go again tonight - I don't have bcc or gcc on this machine.

> 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.

Yes, that's what I've done. I've got it protected with a BOOST_MSVC check,
on the assumption that only MSVC will get this wrong.

Paul.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk