There is a historical reason: before C ++ 11, there were only versions of member functions. Non-members have been added in C ++ 11, which also work for simple C-style arrays, so they can be considered more general.
int a[] = {3, 1, 5, 67, 28, -12}; std::sort(std::begin(a), std::end(a));
When applying the standard library to containers, the effect of std::begin and std::end consists in calling the member functions of the begin() and end() container, so there is no functional difference.
C ++ 14 added std::cbegin , std::cend , std::rbegin , std::rend , std::crbegin and std::crend , with similar behavior.
source share