2 Solutions Collect From Internet About “No member named 'begin' in namespace 'std'”

std::begin was introduced with C++11. See this answer for how to enable C++11 in XCode 4.2 (the precise name of the dialect has probably changed by now).

Alternatively, if you can’t move to C++11, switch to std::vector and use v.begin().

You could be compiling in C++03 mode. Work out how to get your IDE to compile in C++11 mode. XCode 4.2 turn on C++11 may help.

std::sort(std::valarray::begin(v), std::valarray::end(v)); — I don’t think the standard demands this ever work. I guess if valarray implemented begin and end as statics or Koenig friend operators or somesuch.

std::valarray doesn’t come with member begin/end. The only way in C++03 to iterate over it was to use [] or with pointers.