Are clang++ and libc++ compatible?

Zhihao Yuan lichray at gmail.com
Wed Nov 13 15:18:10 UTC 2013


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/


More information about the freebsd-current mailing list