From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 01/11] gdb: introduce iterator_range, remove next_adapter
Date: Mon, 5 Jul 2021 16:41:45 +0100 [thread overview]
Message-ID: <95009c05-bc89-6ad1-682d-b3b5c07d0f45@palves.net> (raw)
In-Reply-To: <20210622165704.2404007-2-simon.marchi@polymtl.ca>
On 2021-06-22 5:56 p.m., Simon Marchi via Gdb-patches wrote:
> I was always a bit confused by next_adapter, because it kind of mixes
> the element type and the iterator type. In reality, it is not much more
> than a class that wraps two iterators (begin and end). However, it
> assumes that:
>
> - you can construct the begin iterator by passing a pointer to the
> first element of the iterable
> - you can default-construct iterator to make the end iterator
>
> I think that by generalizing it a little bit, we can re-use it at more
> places.
>
> Rename it to "iterator_range". I think it describes a bit better: it's
> a range made by wrapping a begin and end iterator. Move it to its own
> file, since it's not related to next_iterator anymore.
>
> iterator_range has two constructors. The variadic one, where arguments
> are forwarded to construct the underlying begin iterator. The end
> iterator is constructed through default construction. This is a
> generalization of what we have today.
>
> There is another constructor which receives already constructed begin
> and end iterators, useful if the end iterator can't be obtained by
> default-construction. Or, if you wanted to make a range that does not
> end at the end of the container, you could pass any iterator as the
> "end".
>
> This generalization allows removing some "range" classes, like
> all_inferiors_range. These classes existed only to pass some arguments
> when constructing the begin iterator. With iterator_range, those same
> arguments are passed to the iterator_range constructed and then
> forwarded to the constructed begin iterator.
>
> There is a small functional difference in how iterator_range works
> compared to next_adapter. next_adapter stored the pointer it received
> as argument and constructeur an iterator in the `begin` method.
> iterator_range constructs the begin iterator and stores it as a member.
> Its `begin` method returns a copy of that iterator.
>
> With just iterator_range, uses of next_adapter<foo> would be replaced
> with:
>
> using foo_iterator = next_iterator<foo>;
> using foo_range = iterator_range<foo_iterator>;
>
> However, I added a `next_range` wrapper as a direct replacement for
> next_adapter<foo>. IMO, next_range is a slightly better name than
> next_adapter.
>
> The rest of the changes are applications of this new class.
LGTM.
next prev parent reply other threads:[~2021-07-05 15:42 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 16:56 [PATCH 00/11] Various thread lists optimizations Simon Marchi via Gdb-patches
2021-06-22 16:56 ` [PATCH 01/11] gdb: introduce iterator_range, remove next_adapter Simon Marchi via Gdb-patches
2021-07-05 15:41 ` Pedro Alves [this message]
2021-07-06 19:16 ` Simon Marchi via Gdb-patches
2021-06-22 16:56 ` [PATCH 02/11] gdb: introduce intrusive_list, make thread_info use it Simon Marchi via Gdb-patches
2021-06-22 23:13 ` Lancelot SIX via Gdb-patches
2021-06-23 0:48 ` Simon Marchi via Gdb-patches
2021-07-05 15:44 ` Pedro Alves
2021-07-06 19:38 ` Simon Marchi via Gdb-patches
2021-07-06 20:45 ` Simon Marchi via Gdb-patches
2021-07-06 21:04 ` Pedro Alves
2021-07-06 21:38 ` Simon Marchi via Gdb-patches
2021-07-06 21:02 ` Pedro Alves
2021-07-06 21:45 ` Simon Marchi via Gdb-patches
2021-07-07 11:46 ` Pedro Alves
2021-07-07 13:52 ` Simon Marchi via Gdb-patches
2021-06-22 16:56 ` [PATCH 03/11] gdb: make inferior_list use intrusive_list Simon Marchi via Gdb-patches
2021-07-05 15:44 ` Pedro Alves
2021-07-14 6:34 ` Tom de Vries
2021-07-14 16:11 ` Simon Marchi via Gdb-patches
2021-07-14 20:15 ` [PATCH] gdb: make all_inferiors_safe actually work Simon Marchi via Gdb-patches
2021-07-15 10:15 ` Tom de Vries
2021-07-17 12:54 ` Simon Marchi via Gdb-patches
2021-06-22 16:56 ` [PATCH 04/11] gdb: use intrusive list for step-over chain Simon Marchi via Gdb-patches
2021-07-05 15:45 ` Pedro Alves
2021-07-06 20:59 ` Simon Marchi via Gdb-patches
2021-06-22 16:56 ` [PATCH 05/11] gdb: add setter / getter for thread_info resumed state Simon Marchi via Gdb-patches
2021-07-05 15:45 ` Pedro Alves
2021-06-22 16:56 ` [PATCH 06/11] gdb: make thread_info::suspend private, add getters / setters Simon Marchi via Gdb-patches
2021-07-05 15:45 ` Pedro Alves
2021-06-22 16:57 ` [PATCH 07/11] gdb: maintain per-process-target list of resumed threads with pending wait status Simon Marchi via Gdb-patches
2021-07-05 15:51 ` Pedro Alves
2021-07-06 21:25 ` Simon Marchi via Gdb-patches
2021-07-07 12:01 ` Pedro Alves
2021-07-12 22:28 ` Simon Marchi via Gdb-patches
2021-07-12 22:34 ` Simon Marchi via Gdb-patches
2021-07-13 12:21 ` Pedro Alves
2021-06-22 16:57 ` [PATCH 08/11] gdb: optimize check for resumed threads with pending wait status in maybe_set_commit_resumed_all_targets Simon Marchi via Gdb-patches
2021-07-05 15:51 ` Pedro Alves
2021-06-22 16:57 ` [PATCH 09/11] gdb: optimize selection of resumed thread with pending event Simon Marchi via Gdb-patches
2021-07-05 15:51 ` Pedro Alves
2021-06-22 16:57 ` [PATCH 10/11] gdb: maintain ptid -> thread map, optimize find_thread_ptid Simon Marchi via Gdb-patches
2021-07-05 15:52 ` Pedro Alves
2021-07-06 21:31 ` Simon Marchi via Gdb-patches
2021-07-07 12:13 ` Pedro Alves
2021-06-22 16:57 ` [PATCH 11/11] gdb: optimize all_matching_threads_iterator Simon Marchi via Gdb-patches
2021-07-05 15:52 ` Pedro Alves
2021-07-14 9:40 ` Tom de Vries
2021-07-13 0:47 ` [PATCH 00/11] Various thread lists optimizations Simon Marchi via Gdb-patches
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=95009c05-bc89-6ad1-682d-b3b5c07d0f45@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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