The std::search_n is a simple algorithm that returns the first instance of n consecutive elements that match the provided value.
The range version conveniently returns the range representing the n consecutive elements, and both versions support a custom comparator.
Compiler Explorer link: https://compiler-explorer.com/z/K5Pxvnrvx