I want to use STL algorithms on pointers and statically allocated arrays, but they all want iterators. Is there any iterator that will take an array and a length and let me use that?
P.S. I’m aware of the array class in C++0x, but I’d prefer not to use it.
Pointers are random-access iterators! You can simply pass a pointer to the start of the array, and a pointer to one past the end. Functions like these (included in C+11) may come handy: