On Wed, Nov 13, 2013 at 9:51 AM, Zhihao Yuan <lichray_at_gmail.com> wrote: >> An implementation of the vector class might allocate all of the elements on the heap lazily, but it's not required to and could equally have space for a small number inside the object, expanding to something like this: >> >> struct Entry { >> struct MangledNameOfVectorOfEntry { >> size_t size; >> Entry small[4]; >> Entry *ptr; >> }; >> }; > > If you don't learn C++, then just don't make claims like these. If I can > not recursively declare std::array<T, N>, which is totally allocated on > stack with layout exactly same as T[N], I would say this implementation > is mad. Sorry, this part is wrong. Stack allocation does require complete type. > A deque is more akin to an array, so in C it would be something like: > [...] > This is clearly nonsense - you can't have a structure that contains itself. > [...] These part has nothing to do with C++. -- Zhihao Yuan, ID lichray The best way to predict the future is to invent it. ___________________________________________________ 4BSD -- http://4bsd.biz/Received on Wed Nov 13 2013 - 14:18:10 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:44 UTC