From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Remove lambdas from _Rb_tree
Date: Fri, 20 Nov 2020 10:22:59 +0000 [thread overview]
Message-ID: <20201120102259.GK1312820@redhat.com> (raw)
In-Reply-To: <616cd512-76cd-5d7c-0a9b-7224816bc245@gmail.com>
On 20/11/20 08:17 +0100, François Dumont via Libstdc++ wrote:
>Here is what I am testing.
>
>I use your enum proposal as an alias for the bool type. I cannot use
>it as template parameter on _M_copy unless I put it at std namespace
>level to use it in definition of the outline _M_copy overload.
You can do it as a member, but the syntax is ugly:
template<typename _Key, typename _Val, typename _KoV,
typename _Compare, typename _Alloc>
template<typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_CopyType _MoveValues, typename _NodeGen>
typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type
_Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::
_M_copy(_Link_type __x, _Base_ptr __p, _NodeGen& __node_gen)
>I also added some tests checking correct usage of
>__move_if_noexcept_cond. I prefer not to change this condition as
>proposed in this patch.
Yes, we can do that later if needed.
>I wonder if I am right to check moved values in those tests ?
Yes, I think that's good.
>I also wonder after writing those tests if we shouldn't clear the
>moved instance, especially when values are moved ? I remember seeing
>some discussion about this but I don't know the conclusion.
It's not required to clear them.
Leaving them with moved-from values means the memory isn't
deallocated, and those nodes can be reused if the container gets
assigned new values.
>Â Â Â libstdc++: _Rb_tree code cleanup, remove lambdas
>
>Â Â Â Use new template parameters to replace usage of lambdas to move or not
>Â Â Â tree values on copy.
>
>Â Â Â libstdc++-v3/ChangeLog:
>
>Â Â Â Â Â Â Â Â Â Â Â * include/bits/move.h (_GLIBCXX_FWDREF): New.
>Â Â Â Â Â Â Â Â Â Â Â * include/bits/stl_tree.h: Adapt to use latter.
>Â Â Â Â Â Â Â Â Â Â Â (_Rb_tree<>::_M_clone_node): Add _MoveValue template parameter.
>Â Â Â Â Â Â Â Â Â Â Â (_Rb_tree<>::_M_mbegin): New.
>Â Â Â Â Â Â Â Â Â Â Â (_Rb_tree<>::_M_begin): Use latter.
>Â Â Â Â Â Â Â Â Â Â Â (_Rb_tree<>::_M_copy): Add _MoveValues template parameter.
>Â Â Â Â Â Â Â Â Â Â Â * testsuite/23_containers/map/allocator/move_cons.cc: New test.
>Â Â Â Â Â Â Â Â Â Â Â * testsuite/23_containers/multimap/allocator/move_cons.cc:
>New test.
>Â Â Â Â Â Â Â Â Â Â Â * testsuite/23_containers/multiset/allocator/move_cons.cc:
>New test.
>Â Â Â Â Â Â Â Â Â Â Â * testsuite/23_containers/set/allocator/move_cons.cc: New test.
>
>Ok to commit once all tests have complete ?
Yes, OK for trunk, thanks!
prev parent reply other threads:[~2020-11-20 10:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 20:51 François Dumont
2020-11-17 23:50 ` Jonathan Wakely
2020-11-19 6:46 ` François Dumont
2020-11-19 11:31 ` Jonathan Wakely
2020-11-19 13:20 ` François Dumont
2020-11-20 7:17 ` François Dumont
2020-11-20 10:22 ` Jonathan Wakely [this message]
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=20201120102259.GK1312820@redhat.com \
--to=jwakely@redhat.com \
--cc=frs.dumont@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@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: link
Be 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).