Skip to content

cppreference Containers library # Member function table # Element access

NOTE:

1、优先使用 at,为了保证bound safety-bounds checking

2、gsl::at

at

Returns a reference to the element at specified location pos, with bounds checking.

If pos is not within the range of the container, an exception of type std::out_of_range is thrown.

operator[]

Returns a reference to the element at specified location pos. No bounds checking is performed.

data

frontback