Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-03-07 14:44:30


On Sun, 7 Mar 2004 17:54:37 -0000, Paul A Bristow wrote:
> Daniel Frey's constant library milestone 2
>
> /MathConstants/constant_library_m2_v1.tgz 21 Aug 2003

Ok, thanks. I have it. After some fixing (change file extension from .cc
to .cpp, change line endings from LF to CRLF, append one more directory
to INCLUDE) I received following error:

example.cpp(18) : error C3200: 'boost::math::pi_value<T>' : invalid
template argument for template parameter 'F', expected a class template
        example.cpp(18) : see reference to class template instantiation
'boost::math::pi_value<T>' being compiled
example.cpp(81) : fatal error C1903: unable to recover from previous
error(s); stopping compilation

I have stripped down problematic code to very simple:

#include <iostream>

template <template <typename> class F, typename T> struct constant_value
{
    T operator()() const
    {
        return T();
    }
};

template <typename T> struct pi_value : constant_value <pi_value, T> {};

int main()
{
  pi_value<double> t;
  std::cout << t();
}

and tried it under Comeau (online), with no problems. It also compiles
fine under GCC 3.3.1 (mingw). From my (limited) understanding of
templates this code is fine, thus apparently there's problem with VC71.
Looks like using template being just defined as template template
parameter makes VC71 confused. I reported it to Microsoft (on its
private newsgroup).

B.


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