Here are two very similar snippets:
vector<int> a;
int n = static_cast<int>(a.size());
// ---------
int f(const vector<int>& a) {
return static_cast<int>(a.size());
}
Here I explicitly cast a value of type size_t to type int. If I omit static_cast then the same cast applies implicitly.
Of which kind would this implicit cast be? Is it safe to omit static_cast in explicit assignments and return statements?