To remove manual logic in my code, I use that construct:
std::ranges::drop_view a { std::ranges::take_view(my_range, my_range.size() -X), Y};
with X and Y values I pass at runtime.
Even though I check the algorithms, I could not find a shorter way that has the following constraints:
- don't go beyond or below the range I want, and don't do anything if the range has 0 elements -> no overflow
- non owning -> no copies
ranges::subranges doesn't meet those requirements.
Thanks