c++ - vector function 'at' -


since other direct access methods front(), back() , [] not check bounds, 'at' introduce overhead these checking if vectors large , 1 wants iterate on them sequentially? guess if 1 sure of bounds, [] better direct access option.

that's why there're separate [] , at(). if you're sure don't access out of bounds use [] (or iterators), otherwise may use at() if wish.


Comments