mardi 3 novembre 2015

How does std::end know the end of array?

std::begin and std::end know the begin and end of a container or an array. It so easy to know the end and begin of a vector for example because it is a class that gives this information. But, how does it know the end of an array like:

int simple_array[5]{1, 2, 3, 4, 5};
auto beg=std::begin(simple_array);
auto en=std::end(simple_array);

std::begin is not that hard to know where the array start. But how it knows where it ends? is the constant integer 5 will be stored some where?

I appreciate if I got an answer with some low-level information.

Aucun commentaire:

Enregistrer un commentaire