diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2025-09-03 10:50:02 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2025-10-07 16:22:15 -0400 |
commit | 99b6de03fe4ac1518e68ac42c124dd5fa1704397 (patch) | |
tree | 90af9ad9f9fb1db9ecd783d6f1e125ea85855839 /gdb/python/py-utils.c | |
parent | f772ad29ab606742aa00db2de62e8983b5ebce0a (diff) | |
download | binutils-99b6de03fe4ac1518e68ac42c124dd5fa1704397.zip binutils-99b6de03fe4ac1518e68ac42c124dd5fa1704397.tar.gz binutils-99b6de03fe4ac1518e68ac42c124dd5fa1704397.tar.bz2 |
gdbsupport: remove variadicity from iterator_range constructor
There are two ways to build an iterator_range:
- Using the variadic constructor, where the arguments you pass are used
to construct the "begin" underlying iterator. The "end" iterator is
obtained by default-constructing the underlying iterator.
- Using the other constructor, by explicitly providing the "begin" and
"end" iterators.
My experience is that using the variadic constructor is very confusing,
especially when you have multiple layers of iterator wrappers. It's not
obvious where the arguments you provide end up. When you have a
compilation error, it is hard to decipher.
I propose to remove the variadicity of the first constructor of
iterator_range, and subsequently of the other iterator wrappers. This
requires callers to be more verbose, explicitly instantiate all the
layers. But since we only instantiate these iterator wrappers in
factory functions, I think it's fine. If there is a compilation error,
it will be much easier to find and fix the problem.
Using the new one-argument constructor, it is still assumed that the end
iterator can be obtained by default-constructing the underlying iterator
type, which I think is fine and not too confusing.
Change-Id: I54d6fdef18bcd7e308825064e0fc18fadd7ca717
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python/py-utils.c')
0 files changed, 0 insertions, 0 deletions