5,321
edits
Line 483: | Line 483: | ||
====std::vector==== | ====std::vector==== | ||
<code>#include <vector></code> | |||
https://en.cppreference.com/w/cpp/container/vector<br> | |||
This is a dynamically-allocated resizable array, known as an ArrayList in Java.<br> | |||
<syntaxhighlight lang="c++"> | <syntaxhighlight lang="c++"> | ||
// Basics | // Basics | ||
Line 510: | Line 508: | ||
my_vec.back(); | my_vec.back(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Note that [https://en.cppreference.com/w/cpp/container/vector_bool <code>vector<bool></code>] is a special case of bit-packed booleans instead of an array of bools. You should use <code>vector<char></code> instead if your code relies on it being continguous.<br> | |||
====std::span==== | ====std::span==== |