Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All


Returns a const iterator that addresses the first element in the range.

const_iterator cbegin() const noexcept;

A const random-access iterator that points at the first element of the range, or the location just beyond the end of an empty range (for an empty range, cbegin() == cend()).

With the return value of cbegin, the elements in the range cannot be modified.

You can use this member function in place of the begin() member function to guarantee that the return value is const_iterator. Typically, it's used in conjunction with the auto type deduction keyword, as shown in the following example. In the example, consider Container to be a modifiable (non-const) container of any kind that supports begin() and cbegin().

auto i1 = Container.begin();  // i1 is Container<T>::iterator 
auto i2 = Container.cbegin(); // i2 is Container<T>::const_iterator

Header: <array>

Namespace: std

© 2015 Microsoft