The call to overloaded 'pow (const double &, double) is ambiguous

I am new to C ++, here is my problem: I need this amount:

h = pow(mesh.V()[i0],1.0/3); 

but I get this error message whenever I compile the program:

  call of overloaded 'pow(const double&, double)' is ambiguous 

And if I write

 double V = mesh.V()[i0]; h = pow(V,1.0/3); 

I get:

  call of overloaded 'pow(double&, double)' is ambiguous 

Now I think I understand that const is double & and double & see, but how can I convert const double & to double?

Thanks!

+4
source share
1 answer

Now I think I understand that const is double & and double & see, but how can I convert const double & to double?

Beware that some compilers use this syntax in error messages to represent something other than what it means in the code. Error messages tell you that the type used as an argument to the function is not what the function executes.

If you want to get double in the error message, you just need to call a function that returns a double , but that is not what you want.

You need to find out why the call is ambiguous. Is the compiler later in the error message, what signature functions are considered? He should and reading the various overloads that he is considering will help to find out why in this context he is ambiguous.

+2
source

All Articles