C++11 introduced free function overloads for std::begin
and std::end
that work on containers and arrays. When used on a container, std::begin
will call the container's begin
function. It seems to me then that there isn't a point in using vect.begin()
anymore and std::begin(vect)
should be used instead for consistency. Is there any reason not to prefer these (aside from compiling in older standard versions)?
Asked
Active
Viewed 108 times
0
-
1I'd suggest `using std::begin; using std::end; begin(vect);`. – T.C. Oct 05 '14 at 13:04
-
No, no reason at all. Prefer free functions over member functions. – Richard Hodges Oct 05 '14 at 13:11
-
I prefer `std::begin` and `std::end` for sexy codenz – Oct 05 '14 at 13:21