I have a container (std::vector
), and I'd like to check if any of its elements satisfy a predicate, to do that I use C++20's std::ranges::any_of
.
The problem is, I'd like this any_of
to skip cetain elements in the middle of the range (a sub-range with known offset and size). How can I "drop" those elements from the range before it goes into the any_of
algorithm, while also not completely erasing them?
What I could think of is to use views::take
and views::drop
to get only the elements outside the subrange, then combining those into a new vector and views::join
ing it. But this seems rather inefficient, and definitely not very clean.
What would be a better way to achieve this result?