I am having problems with a very strange error in some code that I wrote. The basic idea of ββthe code can be trivialized in the following example:
template <class f, class g> class Ptr;
template <class a, class b, class c = Ptr<a,b> >
class Base
{
public:
Base(){};
};
template <class d, class e>
class Derived : public Base <d,e>
{
public:
Derived(){};
};
template <class f, class g>
class Ptr
{
public:
Ptr(){};
Ptr(Base<f,g,Ptr<f,g> >* a){};
};
typedef Derived<double,double> DDerived;
int main()
{
Base<int,int> b = Base<int,int>();
Derived<double,double> d = Derived<double,double>();
DDerived dd = DDerived();
Ptr<double,double> p(&dd);
return 1;
}
The main idea is that pointers are replaced with the Ptr class (this will ultimately be used in MPI configuration, so standard pointers are virtually useless). Pointers are for a βpointβ in the base class and therefore can point to any inherited class (as shown in the example).
Can anyone think of any reason that may not work in a non-trivial case (but the case when the architecture of the object remains identical).
The error that occurs in the main case is as follows:
void function()
{
vector nVector(1);
nVector[0].SetId(1);
Ptr temp(&nVector[1]);
};
( ) MPICXX:
Ptr<double, double>::Ptr(Derived<double, double>*)
., ( )
Ptr<f, g>::Ptr(Base<f, g, Ptr<f, g> >*) [with f = double, g = double]
,
EDITED ( , ββ )