cin to function arguments without variable
You can still create wrapper function:
template <typename T>
T get_input(std::istream& cin)
{
T res;
std::cin >> res;
return res;
}
And then:
const int len = get_input<int>(std::cin);
for (int i = 0; i < len; i++) {
foo(get_input<int>(std::cin));
}