|
Boost : |
From: Michael Stevens (michael_at_[hidden])
Date: 2001-06-27 00:03:40
I really want to use boost Quaternions an would like to produce VC++6.0
(SP5) compatible code. To this end I've been looking at how much
template template parameters workaround help. To this end I put together
a very short piece of test code. The code has two sections: the first
uses template template parameters, the second is the equivilent
transformed into member templates.
Both compile well under gcc2.95.2
VC however has serious problems even with the transformed code. In
particular it is unable to insantiate the template: see // critical
line.
Interestingly if the struct PP is rename struct P (this name is
irrelavent) then an internal compiler error is produced!
All bad news. It doesn't look like it is possible to work around VC++6.0
problems in this case.
Michael Stevens, Senior Research Engineer
Australian Centre for Field Robotics
Tel: +61 2 93512075 Fax: +61 2 93517474
#ifdef HAVE_TEMPLATE_TEMPLATE_PARAMETERS
/*
* Original template template parameter code
*/
template <template <class U> class C>
struct foo {
struct bar { };
C<bar> c;
};
template <class> struct X {};
int main()
{
foo<X> f;
return 0;
}
#else
/*
* Member template code
*/
struct foo {
template <class C>
struct PP
{
struct bar { };
typename C::P<bar> c; // Critical line
};
};
struct X {
template <class I> struct P {I i;};
};
int main()
{
foo::PP<X> f;
return 0;
}
#endif
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk