mercredi 13 juin 2018

c++14 - Is there any difference between vec.begin() and begin(vec)

In this question (https://stackoverflow.com/questions/6926433/how-to-shuffle-a-stdvector) user703016 used the following syntax for accessing the iterators of vector cards_:

For C++98 they recommended using: cards_.begin() and cards_.end()

For C++11 they recommended using: std::begin(cards_) and std::end(cards_)

For C++14, which syntax is preferable, and is there any real difference between the two? Prior to today I've only seen the first syntax.

Aucun commentaire:

Enregistrer un commentaire