C++11 § [support.initlist] 18.9/1 specifies that for std::initializer_list<T>
iterator
must be T*
, so you are guaranteed that sequential elements in a single initializer_list
are contiguous.
In the case of nested lists, e.g., std::initializer_list<std::initializer_list<int>>
, there is no requirement that all elements are contiguous. The top-level list's begin()
must return a pointer to a contiguous array of std::initializer_list<int>
, and each of those lists' begin()
must return a pointer to a contiguous array of int
. Those second-tier int
arrays could be scattered all over memory or stored precisely in total order exactly as you observed. Both ways are compliant.