Using raw pointers (a.k.a. naked pointers) is never a good first choice. Being high maintenance and error prone creatures, you’re far better off using one of the alternatives offered by the standard library.
Having said that, sometimes you simply do not have a choice. You might be working with a block of memory passed on by a hardware component, or you might be stuck with some critical legacy library that “just works” and nobody dares touch today.
In Any case, using naked pointer doesn’t mean you have to go full commando yourself. Many of the STL algorithms would accept, with little or no complaints, raw pointers. an iterator is, after all , a generalized pointer:
The list of numbers in the memory block:
4 numbers are less than 5
Since the array size is not known at compile time, it’s up to you to accurately calculate the begin and end pointers (lines 22,23) , once these pointers contain the proper addresses, they can be passed around just like any other iterator.
note: if it was a static array, it would have been possible to apply the begin() and end() functions (overloaded for static arrays by the standard library):