public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nevin at eviloverlord dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/61023] New: set/map move assignment doesn't move (or copy) the comparator Date: Wed, 30 Apr 2014 22:24:00 -0000 [thread overview] Message-ID: <bug-61023-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61023 Bug ID: 61023 Summary: set/map move assignment doesn't move (or copy) the comparator Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: nevin at eviloverlord dot com If you have a stateful comparator, set/map move assignment does not move (or copy, for that matter) the comparator. Test case: struct Compare { Compare(bool b) : b_(b) {} bool operator()(int l, int r) const { return b_ ? r < l : l < r; } bool b_; }; int main() { typedef std::set<int, Compare> S; S s(Compare(false)); s.insert(2); s.insert(3); assert(*s.begin() == 2); s.clear(); S st(Compare(true)); s = std::move(st); // move assignment s.insert(2); s.insert(3); assert(*s.begin() == 3); // fails return 0; }
next reply other threads:[~2014-04-30 22:24 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-04-30 22:24 nevin at eviloverlord dot com [this message] 2014-04-30 22:27 ` [Bug libstdc++/61023] " nevin at eviloverlord dot com 2014-04-30 22:35 ` nevin at eviloverlord dot com 2014-05-01 21:25 ` nevin at eviloverlord dot com 2014-05-04 15:56 ` redi at gcc dot gnu.org 2014-05-06 23:50 ` ppluzhnikov at google dot com 2014-05-07 13:15 ` [Bug libstdc++/61023] [4.9/4.10 Regression] " redi at gcc dot gnu.org 2014-05-07 14:12 ` redi at gcc dot gnu.org 2014-05-07 14:13 ` redi at gcc dot gnu.org 2014-05-07 14:16 ` redi at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-61023-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).