Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 2013 10:18:08 -0500
From:      Zhihao Yuan <lichray@gmail.com>
To:        David Chisnall <theraven@freebsd.org>
Cc:        Eitan Adler <lists@eitanadler.com>, FreeBSD current <freebsd-current@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>
Subject:   Re: Are clang++ and libc++ compatible?
Message-ID:  <CAGsORuA1jcC7mHcLUVEEWeT05uM85=RmktsRa1q75YR7Un1i_w@mail.gmail.com>
In-Reply-To: <CAGsORuBHmXS9%2B6uwgiUF7mVnMYqoazgX7iYbjF_gS_UxoUmVSg@mail.gmail.com>
References:  <20131112163219.GA2834@troutmask.apl.washington.edu> <20131112165422.GA2939@troutmask.apl.washington.edu> <CAF6rxgmRb3QALsSyVrpR683%2BVzcUnDN0VQja62xn8FTZaRxOKw@mail.gmail.com> <201311121321.07330.jhb@freebsd.org> <9071A5A2-9F8D-4F5A-9EAD-66A680246AFE@FreeBSD.org> <CAGsORuBHmXS9%2B6uwgiUF7mVnMYqoazgX7iYbjF_gS_UxoUmVSg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Nov 13, 2013 at 9:51 AM, Zhihao Yuan <lichray@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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGsORuA1jcC7mHcLUVEEWeT05uM85=RmktsRa1q75YR7Un1i_w>