mardi 12 février 2019

C++: Why is std::vector::data member function introduced?

I was looking at the STL's vector container from below link. And it is mentioned that one of the new member functions added(with C++11) to this container is vector::data, which returns a pointer to the memory array used internally.

http://www.cplusplus.com/reference/vector/vector/data/

The example code given in above link also shows it usage, but it seemed that all that could be done with iterators too.

Is there any specific reason for introduction of this member function?

Aucun commentaire:

Enregistrer un commentaire