Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-04-03 09:32:33


Neal D. Becker wrote:

>Could you elaborate? What didn't work? Any ideas how to fix? I don't use
>MSVC.

Looking at the code, I think the problem is this (although I have not yet
tried it):

template<typename T>
struct Stat_t< std::complex<T> > {
  typedef typename std::complex<T>::value_type value_t;
};

MSVC 7 does not handle partial template specialization, so it will not
compile (you'll need to remove the above specialization). It should work for
MSVC 7.1 final beta, but I do not have a copy of it to verify.

The solution would be to wrap the above in a guard statement similar to:

#if !defined(BOOST_NO_PARTIAL_SPECIALIZATION)
template<typename T>
struct Stat_t< std::complex<T> > {
  typedef typename std::complex<T>::value_type value_t;
};
#endif

NOTE: I'm not sure if the BOOST_NO_PARTIAL_SPECIALIZATION name is correct,
but you get the idea.

Then, if there is partial specialization support the program will work as
indented. Compilers (like MSVC 7) that do not have partial specialization
support will then be able to use the program and it will still work because
the imaginary component is not used in sumXsqr so the complex number is in
essence a real number. There are several concerns with this:
* there is no automatic conversion of a complex number to a real number, so
this is not a complete solution
* output to a stream would probably result in a display of the form:
   (x, y)

I do not how how to get around these problems.

-rhd-
mailto:msclrhd_at_[hidden]

_________________________________________________________________
Hotmail messages direct to your mobile phone http://www.msn.co.uk/mobile


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