From owner-freebsd-current@FreeBSD.ORG Wed Nov 13 14:51:52 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CBA2E87; Wed, 13 Nov 2013 14:51:52 +0000 (UTC) Received: from mail-vc0-x234.google.com (mail-vc0-x234.google.com [IPv6:2607:f8b0:400c:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AE1BB2737; Wed, 13 Nov 2013 14:51:51 +0000 (UTC) Received: by mail-vc0-f180.google.com with SMTP id ib11so343871vcb.39 for ; Wed, 13 Nov 2013 06:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=tebgeUyC+k8HrsPlUHmXvpFx4zY8SNOheJk1adweTiI=; b=hfhcFtdHCpcT0g+V7rUbR1F5Sk1O4qiuTBsvPQTyzEzObAhcMpMWF4dPmGgL6CdnmT MekfLPC9brBRrk5WbFVL30mR3T0u8H1xVYJvkUpq8NY/Rf8EXkl7cIdJT0rb64rnhOST wbWSuoqdBtaowI2dE2rzI5SsNTvfi/GRAnJSldpn3DvFtqghv6DElQVbc+ZhUc19RIAT r4x3UebKxIiC5yYfkmJ+b9PziGP9w6KkDVtBX+e0CEz/8DLFtCu2oxCV+cToxtUyCS30 a4Kqjw7Y9CwWAZFNM7f62jh7gMbSNr9j6fBSKvjcMkfcUxyqi+NKw9sVgADcc/LOAEA/ 72Sw== MIME-Version: 1.0 X-Received: by 10.58.233.98 with SMTP id tv2mr34688909vec.11.1384354310733; Wed, 13 Nov 2013 06:51:50 -0800 (PST) Received: by 10.221.0.145 with HTTP; Wed, 13 Nov 2013 06:51:50 -0800 (PST) In-Reply-To: <9071A5A2-9F8D-4F5A-9EAD-66A680246AFE@FreeBSD.org> References: <20131112163219.GA2834@troutmask.apl.washington.edu> <20131112165422.GA2939@troutmask.apl.washington.edu> <201311121321.07330.jhb@freebsd.org> <9071A5A2-9F8D-4F5A-9EAD-66A680246AFE@FreeBSD.org> Date: Wed, 13 Nov 2013 09:51:50 -0500 Message-ID: Subject: Re: Are clang++ and libc++ compatible? From: Zhihao Yuan To: David Chisnall Content-Type: text/plain; charset=UTF-8 Cc: Eitan Adler , FreeBSD current , Steve Kargl X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2013 14:51:52 -0000 On Wed, Nov 13, 2013 at 5:04 AM, David Chisnall wrote: > 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. > [...] > 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, which is totally allocated on stack with layout exactly same as T[N], I would say this implementation is mad. > It would make sense to have a std:deque or std:deque, because then you're only storing references or pointers to the outer structure in the inner structure. It makes no sense, since you switched from value semantics to reference semantics. -- Zhihao Yuan, ID lichray The best way to predict the future is to invent it. ___________________________________________________ 4BSD -- http://4bsd.biz/