std::begin
and std::end
know the beginning 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 the following?
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 does it know where it ends? Will the constant integer 5
be stored somewhere?
I would appreciate if I got an answer with some low-level information.
See Question&Answers more detail:os