Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing std::front and std::back

Tags:

c++

c++11

Is there a reason std::front and std::back are not present in C++11? There is std::begin and std::end so to me, having the equivalent with regards to actual instances would make sense.

like image 877
abergmeier Avatar asked Feb 14 '13 17:02

abergmeier


1 Answers

std::begin() and std::end() are supposed to work for all fundamental containers (including C-style arrays).

In fact, if the container supports member begin() and end() functions, std::begin() and std::end() forward the call to those member functions.

However, not all containers support front() and back() member functions.

like image 129
Andy Prowl Avatar answered Sep 28 '22 11:09

Andy Prowl