Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 1/3] gdbsupport: add gdb::ranges::views::enumerate util
Date: Thu, 16 Apr 2026 15:52:48 -0400	[thread overview]
Message-ID: <74e7aca0-3a25-4151-87ba-b03fad16b7d9@polymtl.ca> (raw)
In-Reply-To: <20260221011924.2029855-1-simon.marchi@polymtl.ca>

On 2/20/26 8:18 PM, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
> 
> Add a "enumerate" utility, that acts pretty much like Python's
> enumerate().  It makes the code slightly nicer, for when you would
> otherwise need to handle the counter by hand.
> 
> It can be used like this:
> 
>   std::vector<int> my_vector;
>   for (auto [i, val] : gdb::ranges::views::enumerate (my_vector))
>     ...
> 
> `i` will hold the 0-based index of the current iteration, and `val` will
> be a reference to the value of the current iteration.
> 
> The name is chosen to match std::ranges::views::enumerate from C++23,
> making it easy to switch to that eventually.
> 
> Change-Id: I1870ab50537bcf54bba44a30a0b01ab397be16e3

I pushed all 3 patches of this series.

Simon

      parent reply	other threads:[~2026-04-16 19:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 20:19 [PATCH 1/3] gdbsupport: add gdb::enumerate util Simon Marchi
2026-02-20 20:19 ` [PATCH 2/3] gdb/dwarf: use enumerate in index-write.c Simon Marchi
2026-02-20 20:19 ` [PATCH 3/3] gdb: use enumerate in gdbtypes.c Simon Marchi
2026-02-20 20:47 ` [PATCH 1/3] gdbsupport: add gdb::enumerate util Tom Tromey
2026-02-21  0:58   ` Simon Marchi
2026-02-21  1:18 ` [PATCH v2 1/3] gdbsupport: add gdb::ranges::views::enumerate util simon.marchi
2026-02-21  1:18   ` [PATCH v2 2/3] gdb/dwarf: use enumerate in index-write.c simon.marchi
2026-02-21  1:19   ` [PATCH v2 3/3] gdb: use enumerate in gdbtypes.c simon.marchi
2026-03-14 17:32   ` [PATCH v2 1/3] gdbsupport: add gdb::ranges::views::enumerate util Simon Marchi
2026-04-16 19:52   ` Simon Marchi [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=74e7aca0-3a25-4151-87ba-b03fad16b7d9@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.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