c++ - Does a vector<std::array<float,10>> of size 5 result in 50 contiguous floats? -


this question has answer here:

the suggested duplicates not directly answer particular question. 1 of them addresses contiguity of elements of vector without talking array while other discusses use of array instead of float[n] without talking contiguitiness (is word?).

does vector<std::array<float,10>> of size()=5 result in 50 contiguous floats in memory, such pointer vector[0] element points start of stretch of memory?

yes. @ least if create one.

arrays not copyable in c++ have hard time trying insert them in array.

update: yes, vector<array<float, n>> has contiguous memory because vector has requirement , array layout compatible native arrays, no padding or may in middle.

note vector<vector<float>> not have contiguous memory, because each vector has additional fields.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -