On Wed, Nov 13, 2013 at 9:51 AM, Zhihao Yuan <lich...@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/
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to