type *& to type *

Started by
0 comments, last by rip-off 13 years, 4 months ago
I am getting the following error message
"no matching function for call E::computeX( B*&, A&)"

However, I thought I was passing B* and A rather than B*& and A&.

How do I go about converting B*& to B* and A& to A?

Sample header file

class A
{
};

class B
{
};

class C
{
A a;
D * d;
};

Sample implementation file

void C::compute(B b[3], int * i)
{
d->e->computeX(b, a);
}


Where E::computeX(B b[], A a);
Advertisement
The following compiles and runs for me on MSCV 2010:
class A{};class B{};struct E {	void computeX(B b[], A a);};struct D{	E *e;};struct C{A a;D * d;void compute(B b[3], int * i);};// Sample implementation filevoid C::compute(B b[3], int * i){d->e->computeX(b, a);}void E::computeX(B b[], A a) {}int main(){	//A a;	B b[3];	C c;	D d;	E e;	d.e = &e;	c.d = &d;	c.compute(b, 0);}

I'm worried about the number of pointers involved, and the raw array passing without passing the number of elements in the array. Have you considered smart pointers and containers?

This topic is closed to new replies.

Advertisement