When trying to print the first command line argument:
std::cout << argv << std::endl;
warning: 'do not use pointer arithmetic'
Pointers should only refer to single objects, and pointer arithmetic is fragile and easy to get wrong.
span<T>is a bounds-checked, safe type for accessing arrays of data.
Is there an alternative way to use the values of argv without using pointer arithmetic? Isn't accessing a char** by any sensible method going to have to use pointer arithmetic?
You're entirely correct. However, the guideline is about hiding that pointer arithmetic, letting a helper class do bounds checks before performing the arithmetic. You can construct a