Instead of creating a copy, modifying the copy, and comparing to it, use std::span to pass down the maximum allowed length for comparison.