What is element byte alignment in std :: vector <char>?
Container elements have at least the alignment required for them in this implementation: if it intis 4-aligned in your implementation, then each element vector<int>is intand, therefore, is 4-aligned. I say “if” because there is a difference between the size and alignment requirements - just because it intis 4 in size does not necessarily mean that it should be aligned in four, as far as the standard is concerned. This is very common, though, since intit is usually the word size of a machine, and most machines have advantages for accessing memory at word boundaries. Therefore, it makes sense to aligninteven if it is not strictly necessary. For example, on x86, you can perform non-equilibrium memory access by the size of a word, but it is slower than aligned. In ARM, non-primary word operations are not allowed and usually fail.
vectorguarantees continuous storage, therefore, between the first and second element vector<char>there will be no "filling" if it bothers you. A specific requirement for std::vectora fact that 0 < n < vec.size(), &vec[n] == &vec[0] + n.
[: , : , , , value_type. , - , . , .]
++ 1-, , , , vector<bool>. , std::vector<char> . , , , 4-; -)
, - , ++ . , , . , . , , , , , .
, , std::vector 4 ( int ).
, std::vector C. , : - /etc, std::vector<N> v C &v[0]. ( , .)
- , ?
, , ( ). /etc ( ) , , , , .
(, std::list std::map) , , new. new ( , malloc()), , (*). , , , . std::vector, , STL- : new , new[].
(*) ++ " (basic.stc.dynamic.allocation), (expr.new) , ". malloc(), , POSIX: " , , , [...], ++ : char char, .