Originally Posted by
laserlight
I already mentioned it: you can extend the interface. Your notion of a "safe function" is flawed in that if you are going to accept a range, whether denoted by an iterator pair, a range construct or a pointer & size, then you have to trust that the caller provided the correct range. But if you want to extend this such that containers that know their own size can be used, or by allowing arrays of fixed size (besides std::array) to be passed such that their size are automatically determined, then go ahead. But suggesting passing an array by reference as the primary interface seems wrong to me: it is not conventional and limits the ease of use of the function.