Skip to content

Glossary: Coding Interviews in C++

size_t and unsigned

Also written: size_t, std::size_t, std::ssize

`size()` returns an unsigned type, so `size() - 1` on an empty vector wraps to a huge number. Cast to `int` or check `empty()` first; `std::ssize` gives a signed size.

Where the book teaches it

Related terms

static_castInteger overflow