I am new to C++, here is my problem : I need this quantity :
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 what const double& and double& refer to,but how can I convert the const double& to a double?
Thanks!
Now I think I understand what const double& and double& refer to,but how can I convert the const double& to a double?
Beware that some compilers use that syntax in error messages to represent something different than what it means in code. The error messages are telling you what the type used as the argument to the function is, rather than what the function takes.
If you want to get double
in the error message you just need to call a function that returns by value a double
, but that is not what you want.
What you need is to find out why the call is ambiguous. Is the compiler giving you later in the error message what function signatures are considered? It should, and reading the different overloads that it is considering will help in finding out why it is ambiguous in this context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With