Which version of the gcc compiler supports free const_iterator methods for containers, e.g.: cbegin, cend, crbegin, crend. I use gcc 4.6.1 with c++0x features enabled by -std=c++0x flag but these methods could not be resolved in my code.
Which version of the gcc compiler supports free const_iterator methods for containers, e.g.: cbegin
Share
Unfortunately, there are no free functions
cbegin/cendin the standard, nor are there any of the reverse versions. You can always use a cast, though, to get the constant iterator:Using
std::add_constfrom<type_traits>you should even be able to rig up something fairly general if you need this a lot.The container member functions
cbegin/crbeginetc are all part of C++11, and GCC has been supporting those for some time; quite possibly since 4.3 (when C++11 support was first began). GCC 4.6 definitely supports those; if you’re having trouble, post the troublesome code.