what is the best way to detect when a storage vector ends?

the way im trying to do it feels TERRIBLE for performance, what would be a good way to go for this?

Continue to help post