5,321
edits
Line 510: | Line 510: | ||
my_vec.back(); | my_vec.back(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
====std::span==== | |||
<code>#include <span></code><br> | |||
https://en.cppreference.com/w/cpp/container/span<br> | |||
This is view of some contiguous amount of memory. If the size is static, this is equivalent to a single pointer, otherwise is it equivalent to two pointers (i.e. begin and end). | |||
If you use this as the parameter to your function, it will accept both arrays and vectors. | |||
Additionaly, there is a [https://en.cppreference.com/w/cpp/container/span/subspan subspan] function so you don't need to pass around indices or pointers to get subvectors. | |||
====std::deque==== | ====std::deque==== |