From: David Abrahams (abrahams_at_[hidden])
Date: 2000-07-19 07:53:15
----- Original Message -----
From: "Paul A. Bristow" <pbristow_at_[hidden]>
> 2 MSVC++ 6 SP3, the compiler we love to hate does not
> seem to allow initialisation of integral types within
> the class, as C++ Primer P 643 says should be allowed.
> however I am not sure if this is possible with a
> template anyway
Yes, it is possible in standard C++.
> template <typename T>
> class int_math_const
> static const T zero;
> // static const int zero = 0; won't compile MSVC++ 6 SP3
> // but should do for integral types only? C++ Primer p 643
> }; // int_math_const
> // So must explicit instantiate for all integral types?
> const int int_math_const<int>::zero = 0;
> // But how to do others without changing the name?
If you don't need a compile-time constant you must either do that, or:
template <class T>
const T int_math_const<T>::zero = 0;
For things like is_specialized which need to be compile-time constants the
VC6 workaround is to use an enum.
> 3 I have built in a MACRO switch _THROW0() with
> the default to never give a throw() specification.
That name is reserved for the implementation, due to its leading-underscore
+ capital letter prefix.
let's use BOOST_NO_THROW instead if you really think it's important.
(Personally, I think the exception-specification is a waste of time in this
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk