I successfully compiled on Windows a code that should be crossplatform. Now when compiling it in Xcode with Mac OS X, I get:
std::valarray v(32)
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).
std::begin
Alternatively, if you can't move to C++11, switch to std::vector and use v.begin().
std::vector
v.begin()