Yes, std::begin and std::end can work with parameters that are arrays of C. styles
The trick is to pass a parameter, which is an array of styles C. When you specify a 1D array as a normal parameter for a normal function, its type is quietly configured from the "array T" to "pointer to T". When you call this function, what is passed is not an array (like an array), but a pointer to the first element of the array.
However, you can pass an array by reference to a function template:
template <class T, size_t N> void function(T (&array)[N]) { // function body here }
In this case, when you pass the actual array (albeit by reference) and not a pointer, you can use std::begin and std::end perfectly. For example:
template <class T, size_t N> T sum(T (&array)[N]) { return std::accumulate(std::begin(array), std::end(array), T()); }
Now passing the array is trivial, for example:
int array[] = {1, 2, 3, 4}; auto total = sum(array);
std::begin and std::end themselves are implemented similarly to sum - the array is passed by reference, so they may look something like this:
template <class T, size_t N> T *begin(T (&array)[N]) { return array; } template <class T, size_t N> T *end(T (&array)[N]) { return array + N; }
Please note that although they were added to the standard quite recently, they do not require special use of templates, so the implementation above should work fine with the plain old C ++ 98 compiler (and, if memory serves, even with preliminary standard compilers such as VC ++ 6).