Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-01-22 11:01:35

From: "Moore, Paul" <paul.moore_at_[hidden]>


> template <typename IntType> inline rational<IntType>
> operator- (boost::call_traits<IntType>::param_type i, const
> rational<IntType>& r)
> {
> return rational<IntType>(i) -= r;
> }
> The problem is that, for a user-defined integer type MyInt,
> 4 - rational<MyInt>(9,2)
> doesn't compile.

It's MSVC.

boost::call_traits<IntType>::param_type is non-deducible. However, when
faced with such a situation, MSVC 'creatively' deduces the first template
parameter (in this case IntType) from the type of the first argument (in
this case an int.) This is probably a hack in the compiler.

Peter Dimov
Multi Media Ltd.

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