B
BCC
If I have:
double x = 0.0;
std::vector<std::string> local_vector;
local_vector.push_back("One!");
local_vector.push_back("Two!");
I am looking at some code from a colleague that does this all over the
place:
x = static_cast<double>( local_vector.size() );
Is this useful? I know that an int (or size_t) is promoted to a double
in this case. Is the static_cast expensive? It seems like a waste of
keystrokes and time to me... but I wasnt 100% sure.
Thanks,
B
double x = 0.0;
std::vector<std::string> local_vector;
local_vector.push_back("One!");
local_vector.push_back("Two!");
I am looking at some code from a colleague that does this all over the
place:
x = static_cast<double>( local_vector.size() );
Is this useful? I know that an int (or size_t) is promoted to a double
in this case. Is the static_cast expensive? It seems like a waste of
keystrokes and time to me... but I wasnt 100% sure.
Thanks,
B