This question already has an answer here:
In:
C:\Program Files\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++\bits\range_access.h
there is following implementation of std::begin, there are two functions:
/**
* @brief Return an iterator pointing to the first element of
* the container.
* @param __cont Container.
*/
template<typename _Container>
inline auto
begin(_Container& __cont) -> decltype(__cont.begin())
{ return __cont.begin(); }
/**
* @brief Return an iterator pointing to the first element of
* the const container.
* @param __cont Container.
*/
template<typename _Container>
inline auto
begin(const _Container& __cont) -> decltype(__cont.begin())
{ return __cont.begin(); }
my question is why the second overload is actually needed?
Here is some test code I used to find whether I have missed something: http://ift.tt/2j22rzK
Aucun commentaire:
Enregistrer un commentaire