Hello,

Let's say we have a 'Vec' class that it is defined using the vector class. Also, let's assume i have overloaded the function operator, so that i can do the following:

Vec a;

a(0) = 1;

a(1) = 4;

... and so on.

what the operator () returns is just this:

return (*this.[i]);

where 'i' is the index 0,1,...... and [] is because the object of the class is a vector object.

Having say that, i would like to obtain the address of the first element in the object of the class 'Vec' as I would do it in the vector class, that is: &v(0), where v is an object of the vector class: vector<double> v(2)

Can I do the same with a? that is: &a(0)

I have read that overloading the operator & is not a good idea, how can i do the same in other way?

thanks.

Let's say we have a 'Vec' class that it is defined using the vector class. Also, let's assume i have overloaded the function operator, so that i can do the following:

Vec a;

a(0) = 1;

a(1) = 4;

... and so on.

what the operator () returns is just this:

return (*this.[i]);

where 'i' is the index 0,1,...... and [] is because the object of the class is a vector object.

Having say that, i would like to obtain the address of the first element in the object of the class 'Vec' as I would do it in the vector class, that is: &v(0), where v is an object of the vector class: vector<double> v(2)

Can I do the same with a? that is: &a(0)

I have read that overloading the operator & is not a good idea, how can i do the same in other way?

thanks.