Tuesday, 1 October 2013

How to check if a function parameter is constant?

How to check if a function parameter is constant?

This may be easy and I could be just missing what is right in front of me.
However, I cannot figure out how to ensure a function parameter, passed by
reference, can be modified. Essentially i need the following:
bool calculate(double lat, double lon, double dep,
double &x, double &y, double &z)
{
if (x, y, AND z are NOT const)
{
perform the proper calculations
assign x, y, and z their new values
return true;
}
else //x, y, or z are const
{
return false;
}
}
The "if" statment check is really all i need
Again I apologize if this is already on this site or if it's a standard
library function that i'm missing right in front of me. I come here all
the time and virtually always get a good answer but I could not find
anything on this already on here.

No comments:

Post a Comment