Item 13 from Scott Mayers' "Effective Modern C++" states to prefer const_iterators over iterators. I agree but I also want to use non-member functions rather than member functions. According to the book there should be a non-member function std::cbegin()
and std::cend()
in C++14.
To make use of this functions I just installed gcc version 4.9.2 and compiled with the flag -std=c++14
. It seems to compile until I try to use std::cbegin()
. I start searching for the support for this function but couldn't find anything about it. For example, at gnu onlinedocs status the function isn't even mentioned.
My question is, will std::cbegin()
and std::cend()
really be supported in c++14 or is this a mistake in the book? If it will be a C++14 feature, are there compilers which already support these functions and when will gcc support it?
There are many questions at SO about begin()
but these questions are about the member functions or about the constexpr-ness and not about the support of the non-member variant.
GCC 4.9's support for C++14 is experimental and incomplete. But here, you can see that
were added in GCC 5.1.