[pooma-dev] Explicit Instantiation Problem with Pooma 2 using KCC on RH 6.2 Linux
Jeffrey Oldham
oldham at codesourcery.com
Fri May 4 00:38:19 UTC 2001
Thursday, 2001May03
Dave Nyholm submitted a program equivalent to
#include "Pooma/NewFields.h"
template View1<Field<NoGeometry<(int)3>, int, CompressibleBrickView>,
Interval<(int)3> >::sv;
I fail to see why it should compile.
To complete explicit instantiation of Field<GT,T,ET>,
View1<Field<GT,T,ET>, Domain_t>::ReadType_t
Field<GT,T,ET>::read() const;
must be instantiated. Assume all of the class definition upto but
excluding read() has been processed. Here is an excerpt of the
relevant code:
template<class GeometryTag,
class T = POOMA_DEFAULT_ELEMENT_TYPE,
class EngineTag = POOMA_DEFAULT_ENGINE_TYPE>
class Field {
public:
typedef Field<GeometryTag, T, EngineTag> This_t;
// ...
inline typename View1<This_t, Domain_t>::ReadType_t
read() const
{
typedef View1<This_t, Domain_t> Ret_t;
return Ret_t::makeRead(*this, physicalDomain());
}
};
template<class GeometryTag, class T, class EngineTag, class Sub1>
struct View1<Field<GeometryTag, T, EngineTag>, Sub1>
{
// Convenience typedef for the thing we're taking a view of.
typedef Field<GeometryTag, T, EngineTag> Subject_t;
// ... series of typedefs; Dispatch_t relies on Subject_t
typedef typename Dispatch_t::ReadType_t ReadType_t;
// ...
};
Thus, View1<Field<GT,T,ET>, Domain_t> must be instantiated at least up
to the definition of ReadType_t. Its first typedef requires
instantiation of Field<GT,T,ET>, which is being processed. Thus,
compilation fails.
We could try to rewrite View1<Field<GT,T,ET>, Domain_t> to just refer
to Field<GT,T,ET>'s members, avoiding the initial typedef.
Unfortunately, member function makeRead() has a Field<GT,T,ET>
argument.
How should we solve the problem?
Jeffrey D. Oldham
oldham at codesourcery.com
More information about the pooma-dev
mailing list