Summary
This episode explores C++20's new std::shift_left and std::shift_right algorithms, which provide a standardized way to shift elements within containers. Jason explains how these algorithms work and their key behaviors, including how they handle out-of-range shift values and what happens to the vacated positions after shifting. Importantly, he demonstrates that elements shifted out of range are left in a valid but unspecified state, similar to how objects behave after being moved from in standard containers.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[forward.list.modifiers]44% match -
[alg.modifying.operations]40% match