I know that for arrays we can use std::begin(arr) but not arr.begin(), but that's the only case I can think of. In other cases, even when writing templates, I think we can just stick to xxx.begin(), where xxx is of template type T. So what's the benefit of using std::begin()? Is there any reason other than arrays?
For example, in the following case there seems to be no difference between the two.
template<typename T>
void print_first(T sth){
std::cout << *sth.begin() << std::endl;
}
int main()
{
std::vector<int> vec{1,2,3} ;
print_first(vec);
return 0;
}