Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 2013 09:52:35 -0500
From:      Zhihao Yuan <lichray@gmail.com>
To:        Shane Ambler <FreeBSD@shaneware.biz>
Cc:        David Chisnall <theraven@freebsd.org>, Tijl Coosemans <tijl@coosemans.org>, Dimitry Andric <dim@freebsd.org>, Steve Kargl <sgk@troutmask.apl.washington.edu>, FreeBSD current <freebsd-current@freebsd.org>
Subject:   Re: Are clang++ and libc++ compatible?
Message-ID:  <CAGsORuCeR%2B07bEjb=W0bQbsj5ZM%2BdsLBrg7pDPHnoWMW9%2BzkHA@mail.gmail.com>
In-Reply-To: <52832A63.1000601@ShaneWare.Biz>
References:  <20131112163219.GA2834@troutmask.apl.washington.edu> <77CB2B92-216A-4C80-B033-7E582B5F0DFC@FreeBSD.org> <20131112165422.GA2939@troutmask.apl.washington.edu> <E0FE40D9-726C-4501-B31A-3622510C1C68@FreeBSD.org> <20131112175556.GA3319@troutmask.apl.washington.edu> <20131112201922.GA4330@troutmask.apl.washington.edu> <20131112221946.78602db0@kalimero.tijl.coosemans.org> <52832A63.1000601@ShaneWare.Biz>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Nov 13, 2013 at 2:29 AM, Shane Ambler <FreeBSD@shaneware.biz> wrote:
> A possible solution I found looking into this is to wrap the Entry
> reference in a std::unique_ptr - so changing -
> std::deque<Entry> messages;
> to -
> std::deque<std::unique_ptr<Entry>> messages;

This "fix" is wrong.  (Smart) pointers of T have comparison behaviors
different from T itself, so this may silently change a program's runtime
behavior.

A better fix is to use `std::deque<std::vector<Entry>>`.  Both
libstdc++ and libc++ support vector<Incomplete Type>, and
vector<T>'s comparison behavior is as same as T.  And of
course,they both have value semantics.

-- 
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?CAGsORuCeR%2B07bEjb=W0bQbsj5ZM%2BdsLBrg7pDPHnoWMW9%2BzkHA>