string::operator[]

Return a character without bounds checking.

Synopsis

char&
operator[](
    std::size_t pos); (1)

const char&
operator[](
    std::size_t pos) const; (2)

Description

Returns a reference to the character specified at location pos.

Complexity

Constant.

Precondition

pos >= size

Parameters

Name Description

pos

A zero-based index to access.