Implementation details of the stl Array class

B

Bob Langelaan

I apologize if this question has been posted before. I did a search and could not find anything useful.

If you use the sizeof operator on an std::array object, all of the bytes appear to be taken up by the internal array. Which leaves no memory left foroverhead information. Where is the overhead information kept? How is it accessed? Any other implementation details would be appreciated.

Thanks in advance,
Bob
 
S

Stefan Ram

Bob Langelaan said:
If you use the sizeof operator on an std::array object, all
of the bytes appear to be taken up by the internal array.
Which leaves no memory left for overhead information. Where
is the overhead information kept? How is it accessed?

::std::array is a POD class, an aggregate.

It is based on the effect that wrapping an array
in a struct will yield favorable features (such as
assignability and non-decay) even in C.

Therefore, there is no need for overhead.

The information about the size is kept by the compiler, it
is not stored at runtime as in the case of ::std::vector.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top