Re: Are clang++ and libc++ compatible?

From: Zhihao Yuan <lichray_at_gmail.com>
Date: Wed, 13 Nov 2013 09:52:35 -0500
On Wed, Nov 13, 2013 at 2:29 AM, Shane Ambler <FreeBSD_at_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/
Received on Wed Nov 13 2013 - 13:52:36 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:44 UTC