[binutils-gdb] [gdbsupport] Add parameterless iterator_range constructor

Tom de Vries via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a4f9f637306bc99d2e4714bd2b92e4f21841de9f

commit a4f9f637306bc99d2e4714bd2b92e4f21841de9f
Author: Tom de Vries <[email protected]>
Date:   Fri Apr 24 14:17:29 2026 +0200

    [gdbsupport] Add parameterless iterator_range constructor
    
    I noticed that there's no convenient way to create an empty range in
    iterator_range.  Add this.

Diff:
---
 gdb/unittests/iterator-range-selftests.c | 2 +-
 gdbsupport/iterator-range.h              | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/unittests/iterator-range-selftests.c b/gdb/unittests/iterator-range-selftests.c
index a05531d95e0..7c0f7f57484 100644
--- a/gdb/unittests/iterator-range-selftests.c
+++ b/gdb/unittests/iterator-range-selftests.c
@@ -67,7 +67,7 @@ test_iterator_range ()
 
   {
     /* Empty range.  */
-    auto r3 = int_array_iterator_range (end, end);
+    auto r3 = int_array_iterator_range ();
     test_iterator_range_1 (r3, nullptr, 0, end, end);
   }
 
diff --git a/gdbsupport/iterator-range.h b/gdbsupport/iterator-range.h
index 42185546f5a..02a422852e8 100644
--- a/gdbsupport/iterator-range.h
+++ b/gdbsupport/iterator-range.h
@@ -27,6 +27,9 @@ struct iterator_range
 {
   using iterator = IteratorType;
 
+  /* Create an empty range.  */
+  iterator_range () = default;
+
   /* Create an iterator_range using BEGIN as the begin iterator.
 
      Assume that the end iterator can be default-constructed.  */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.