src: prefer data accessor of string and vector
The pattern of getting the address of the element at index 0 of a container is generally used to materialize a pointer to the backing data of a container, however std::string
and std::vector
provide a data()
accessor to retrieve the data pointer which should be preferred.
This also ensures that in the case that the container is empty, the data pointer access does not perform an errant memory access.