Seeming g++-specific "feature deficit"...
Marc Glisse
marc.glisse@inria.fr
Sat Oct 4 06:41:00 GMT 2014
On Fri, 3 Oct 2014, Linda A. Walsh wrote:
> Running > g++ --version
> g++ (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388]
> on a recent kernel, I have the following program that comes up with an error:
>
>
>> g++ --std=c++11 valA.cc
> valA.cc: In function âint main(int, char**)â:
> valA.cc:34:38: error: âclass std::valarray<std::basic_string<char> >â has no
> member named âbeginâ
> for (auto &group:groups) sort(group.begin(), group.end());
> ^
> valA.cc:34:53: error: âclass std::valarray<std::basic_string<char> >â has no
> member named âendâ
> for (auto &group:groups) sort(group.begin(), group.end());
> ^
> ----
> What I couldn't figure out was why the valarray had no begin or end members.
>
> It does on the Mac CLANG compiler.
>
> So why not under gnu c++?
Because that is a non-standard function, obviously...
http://en.cppreference.com/w/cpp/numeric/valarray
Look for "begin".
You can write begin(group) but not group.begin().
--
Marc Glisse
More information about the Libstdc++
mailing list