Skip to content

Implement clear() and contains() functionality across data structures#52

Merged
lrleon merged 30 commits intomasterfrom
add-clean
Mar 29, 2026
Merged

Implement clear() and contains() functionality across data structures#52
lrleon merged 30 commits intomasterfrom
add-clean

Conversation

@lrleon
Copy link
Copy Markdown
Owner

@lrleon lrleon commented Mar 28, 2026

Summary by CodeRabbit

  • New Features

    • Added convenience container APIs: clear(), is_empty(), contains(), contains_if(), and broader sequence equality support.
  • Tests

    • Added and extended unit tests covering membership, equality/inequality, clear/empty behavior, and cache semantics.
  • Documentation

    • Improved API documentation comments and README formatting.
  • Chores

    • Various API const-correctness and signature refinements for more predictable behavior.

lrleon added 25 commits January 28, 2026 09:44
Se añade el alias clear() como sinónimo de empty() en múltiples contenedores
para mejorar la compatibilidad con STL y consistencia de API. También se
agregan métodos contains() y contains_if() a contenedores secuenciales y
se implementa is_empty() en grafos y tablas hash. Se incluyen pruebas
unitarias para verificar la funcionalidad de clear() y operadores de
igualdad en listas dinámicas.
Copilot AI review requested due to automatic review settings March 28, 2026 18:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds convenience APIs (clear(), is_empty(), contains(), contains_if()), const overloads, equality mixin imports, and small noexcept/signature tweaks across many container and search headers; supplements with unit tests exercising these APIs. No algorithmic changes; most clear() implementations delegate to existing empty().

Changes

Cohort / File(s) Summary
Tests
Tests/array.cc, Tests/dynarray.cc, Tests/dyndlist.cc, Tests/dynlist.cc, Tests/dynsethash.cc, Tests/quadtree_test.cc, Tests/ringfilecache.cc, Tests/memarray.cc
Added/extended GoogleTest coverage for clear(), empty()/is_empty(), contains(), contains_if(), equality operators and reuse-after-clear semantics.
Locate / Search utilities
ah-dry.H
Added LocateFunctions::contains_if(Operation&&) const noexcept(...) and contains(const Type&) const; minor Doxygen wording edits and noexcept spacing fixes.
Clear()/is_empty() API additions (various containers & heaps)
archeap.H, archeap.H (ArcFibonacciHeap), quadtree.H, ringfilecache.H, tpl_dynBinHeap.H, tpl_dynSetTree.H, tpl_graph.H, tpl_memArray.H, tpl_dynArray.H, tpl_array.H, tpl_arrayStack.H, tpl_arrayQueue.H, tpl_dynListQueue.H, tpl_dynListStack.H, tpl_dyn_slist_nc.H, tpl_dynDlist.H
Added clear() methods that forward to empty(); some types gained is_empty() accessors; MemArray::empty() changed to noexcept and MemArray::clear() added. Mostly Doxygen and small signature/noexcept adjustments.
Hash / Map / Set interfaces
hashDry.H, tpl_dynSetHash.H, tpl_hash.H, tpl_lhash.H, tpl_linHash.H, tpl_odhash.H, tpl_olhash.H, tpl_dynSetHash.H
Reintroduced/exposed contains (either via delegation or using Base::contains), added clear()/is_empty() and Base type aliases in several hash table types; documentation updates.
List / sequence containers & equality mixins
htlist.H, tpl_dynDlist.H, tpl_dyn_slist_nc.H, tpl_dynlist.cc, tpl_dynListQueue.H, tpl_dynListStack.H, tpl_dynArray.H
Introduced EqualSequenceMethod inheritance for some lists, added clear() noexcept aliases, added const overloads and equality operator tests; iterator and accessor doc and const-correctness edits.
Node & iterator const-correctness
slink_nc.H, tpl_snode_nc.H, tpl_dyn_slist_nc.H
Added const overloads for node accessors and iterator methods, adjusted exception specifications and iterator accessor implementations — API/const-correctness changes requiring careful review.
Search engine constructor signature tweaks
Alpha_Beta.H, Backtracking.H, Branch_And_Bound.H, Negamax.H, State_Search_IDA_Star.H
Changed multiple search-related constructors to take SearchLimits by const SearchLimits & instead of by value (affects overload resolution and caller semantics).
Other small API tweaks and docs
search_move_ordering.H, tpl_polynomial.H, README.md, README.es.md, Examples/adversarial_artificial_example.cc
Made Null_History_Heuristic_Table::score static/noexcept, minor Doxygen/README formatting changes, and converted several domain methods to static in an example.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Header Docstring Coverage ⚠️ Warning Documentation coverage of 42-44 new public declarations is approximately 12-14%, far below the required 80% threshold. Add Doxygen documentation blocks with @brief, @param, and @throws to all 36 undocumented public methods before merging.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Implement clear() and contains() functionality across data structures' directly and comprehensively summarizes the primary objective of the changeset, which adds clear() and contains() methods to multiple container classes throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-clean

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds clear() convenience aliases (and a few related query helpers) across Aleph-w containers to align APIs and improve ergonomics, plus corresponding unit tests.

Changes:

  • Add clear() as an alias for empty() across many containers (arrays, lists, heaps, hash tables, etc.).
  • Add LocateFunctions::contains_if() and LocateFunctions::contains() helpers, and enable sequence equality for DynList/DynDlist via EqualSequenceMethod.
  • Add/extend tests covering clear(), contains*(), and sequence equality.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tpl_memArray.H Adds clear() alias for empty() in MemArray.
tpl_linHash.H Adds clear() alias for empty() in linear hash table.
tpl_lhash.H Adds clear() alias for empty() in list-based hash table.
tpl_hash.H Adds clear() and is_empty() wrappers for HashSet/HashMap.
tpl_graph.H Adds Path::clear() alias for Path::empty().
tpl_dyn_slist_nc.H Adds clear() alias for empty() in Dyn_Slist_Nc.
tpl_dynSkipList.H Normalizes clear() comment text.
tpl_dynSetTree.H Adds clear() alias for empty() in DynSetTree.
tpl_dynSetHash.H Adds clear() (and is_empty() wrapper) for dynamic hash table wrapper.
tpl_dynDlist.H Adds EqualSequenceMethod base + clear() alias for empty() in DynDlist.
tpl_dynBinHeap.H Adds clear() alias for empty() in DynBinHeap.
tpl_dynArray.H Adds clear() alias for empty() in DynArray.
tpl_arrayStack.H Adds clear() alias for empty() in array-backed stack(s).
tpl_arrayQueue.H Adds clear() alias for empty() in array-backed queue.
tpl_array.H Adds clear() alias for empty() in Array.
ringfilecache.H Adds clear() alias for empty() in ring file cache.
quadtree.H Adds clear() alias for empty() in quadtree.
htlist.H Adds EqualSequenceMethod base + clear() alias for empty() in DynList.
hashDry.H Adds clear() alias for empty() in open-addressing hash base.
graph-dry.H Adds is_empty() accessor for graphs.
archeap.H Adds clear() alias for empty() in arc heap types.
ah-dry.H Adds contains_if() / contains() to LocateFunctions.
Tests/dynsethash.cc Adds tests for clear() on hash table/map wrappers.
Tests/dynlist.cc Adds tests for DynList::clear(), contains(), and equality operators.
Tests/dyndlist.cc Adds tests for DynDlist equality operators.
Tests/dynarray.cc Adds tests for DynArray::clear() and contains*().
Tests/array.cc Adds tests for Array::contains() and contains_if().

Comment thread ah-dry.H Outdated
Comment thread tpl_memArray.H Outdated
Comment thread graph-dry.H Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (4)
quadtree.H (1)

534-536: Implementation looks good; consider improving Doxygen consistency.

The alias implementation is correct. For consistency with the rest of the file's documentation style, consider using the @brief tag and adding a cross-reference to empty().

📝 Optional documentation enhancement
-  /// Alias for empty()
-  void clear() { empty(); }
+  /** `@brief` Clear all points from the tree.
+   *  `@see` empty()
+   */
+  void clear() { empty(); }

As per coding guidelines: "If a new public method or class is added, a corresponding unit test MUST be created." Since clear() is a trivial alias to empty(), you might add a simple test case that verifies clear() behaves identically to empty(), or document why it's covered by existing empty() tests.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@quadtree.H` around lines 534 - 536, Replace the brief doc for clear() to
match file style: add a Doxygen `@brief` tag and a cross-reference to empty()
(e.g., "@brief Alias for empty(). See empty() for behavior.") so it is
consistent with other comments; also add a tiny unit test exercising
Quadtree::clear() that verifies it yields the same state as empty() (or add a
test note explaining why existing empty() tests cover clear()) to satisfy the
testing guideline.
tpl_memArray.H (1)

349-351: Consider adding noexcept specifier for API consistency.

The implementation is correct. However, since empty() only performs n = 0 (a non-throwing operation), both empty() and clear() could be marked noexcept to provide stronger exception guarantees. This would also align with Array<T>::clear() and DynArray<T>::clear() which are marked noexcept.

♻️ Optional: Add noexcept specifier
   /// Empty the container. The array is not contracted
-  void empty() { n = 0; }
+  void empty() noexcept { n = 0; }

   /// Alias for empty()
-  void clear() { empty(); }
+  void clear() noexcept { empty(); }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tpl_memArray.H` around lines 349 - 351, Mark the non-throwing methods as
noexcept for API consistency: add the noexcept specifier to
tpl_memArray::empty() (since it only does n = 0) and to the alias method
tpl_memArray::clear() (currently defined as void clear() { empty(); }) so their
declarations/definitions match Array<T>::clear() and DynArray<T>::clear()
semantics and provide stronger exception guarantees.
graph-dry.H (1)

697-699: Nice to have: make is_empty() constexpr for accessor consistency.

Line 698 is a pure state check, like neighboring size accessors, so it can be constexpr too.

♻️ Proposed tweak
-  [[nodiscard]] bool is_empty() const noexcept { return num_nodes == 0; }
+  [[nodiscard]] constexpr bool is_empty() const noexcept { return num_nodes == 0; }

As per coding guidelines: Use constexpr for compile-time constants and functions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@graph-dry.H` around lines 697 - 699, Make the accessor is_empty() constexpr
by changing its declaration from [[nodiscard]] bool is_empty() const noexcept to
[[nodiscard]] constexpr bool is_empty() const noexcept so the empty check can be
evaluated at compile time; update the member function signature for is_empty()
(which reads num_nodes) and ensure num_nodes remains a constexpr-friendly member
(no runtime-only requirements) so the function compiles as constexpr.
Tests/array.cc (1)

357-366: Good test coverage, consider adding empty array edge case.

The test appropriately validates both contains() and contains_if() methods with present/absent elements and matching/non-matching predicates.

Per coding guidelines, tests should cover edge cases including empty inputs. Consider adding a test for an empty array to ensure both methods return false.

🧪 Suggested addition for empty array coverage
 TEST(ArraySearch, Contains)
 {
   Array<int> arr = {10, 20, 30, 40};
   EXPECT_TRUE(arr.contains(20));
   EXPECT_TRUE(arr.contains(40));
   EXPECT_FALSE(arr.contains(50));
 
   EXPECT_TRUE(arr.contains_if([](int x) { return x > 25; }));
   EXPECT_FALSE(arr.contains_if([](int x) { return x > 100; }));
+
+  Array<int> empty;
+  EXPECT_FALSE(empty.contains(1));
+  EXPECT_FALSE(empty.contains_if([](int) { return true; }));
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Tests/array.cc` around lines 357 - 366, Add an edge-case test that verifies
Array<T>::contains and Array<T>::contains_if return false for an empty Array;
for example extend the TEST(ArraySearch, Contains) or add a new
TEST(ArraySearch, ContainsEmpty) that constructs Array<int> arr = {} (or
Array<int> empty) and asserts EXPECT_FALSE(empty.contains(whatever)) and
EXPECT_FALSE(empty.contains_if([](int){ return true; })), referencing the Array
class and its contains and contains_if methods.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ringfilecache.H`:
- Around line 870-872: The new public method clear() is missing a full Doxygen
contract; update the declaration of clear() to include a Doxygen block
documenting it as an alias of empty(): add `@brief` explaining that clear()
removes all entries, document that it has no parameters, add `@return` describing
the (void) result, include `@throws` (none) or note noexcept to indicate it never
throws, and mention it calls/aliases empty() so callers know equivalence to the
empty() method; reference the clear() method and the empty() implementation in
the docs.
- Around line 870-872: Add a unit test that exercises RingFileCache::clear() and
verifies it behaves identically to RingFileCache::empty(): set up a populated
RingFileCache, call clear(), then assert the cache state is emptied (e.g.,
size() == 0 and any isEmpty()/contains() checks match the empty() behavior);
also test that calling clear() on an already-empty cache is a no-op and matches
empty() results. Reference the RingFileCache::clear() and RingFileCache::empty()
methods in the test and include assertions for size() and any public inspection
APIs used to validate contents.

In `@tpl_dynBinHeap.H`:
- Around line 263-265: Add a full Doxygen contract for the new public method
clear() (which currently calls empty()), replacing the brief alias comment;
include `@brief` describing that clear() removes all elements from the heap,
`@param` noting there are none, `@return` void, and `@throws` documenting that it is
noexcept and thus throws nothing (or listing no exceptions), and reference that
it delegates to empty() so readers know behavior and exception-safety; ensure
tags and wording follow existing class (dynBinHeap) documentation style.

---

Nitpick comments:
In `@graph-dry.H`:
- Around line 697-699: Make the accessor is_empty() constexpr by changing its
declaration from [[nodiscard]] bool is_empty() const noexcept to [[nodiscard]]
constexpr bool is_empty() const noexcept so the empty check can be evaluated at
compile time; update the member function signature for is_empty() (which reads
num_nodes) and ensure num_nodes remains a constexpr-friendly member (no
runtime-only requirements) so the function compiles as constexpr.

In `@quadtree.H`:
- Around line 534-536: Replace the brief doc for clear() to match file style:
add a Doxygen `@brief` tag and a cross-reference to empty() (e.g., "@brief Alias
for empty(). See empty() for behavior.") so it is consistent with other
comments; also add a tiny unit test exercising Quadtree::clear() that verifies
it yields the same state as empty() (or add a test note explaining why existing
empty() tests cover clear()) to satisfy the testing guideline.

In `@Tests/array.cc`:
- Around line 357-366: Add an edge-case test that verifies Array<T>::contains
and Array<T>::contains_if return false for an empty Array; for example extend
the TEST(ArraySearch, Contains) or add a new TEST(ArraySearch, ContainsEmpty)
that constructs Array<int> arr = {} (or Array<int> empty) and asserts
EXPECT_FALSE(empty.contains(whatever)) and
EXPECT_FALSE(empty.contains_if([](int){ return true; })), referencing the Array
class and its contains and contains_if methods.

In `@tpl_memArray.H`:
- Around line 349-351: Mark the non-throwing methods as noexcept for API
consistency: add the noexcept specifier to tpl_memArray::empty() (since it only
does n = 0) and to the alias method tpl_memArray::clear() (currently defined as
void clear() { empty(); }) so their declarations/definitions match
Array<T>::clear() and DynArray<T>::clear() semantics and provide stronger
exception guarantees.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7904b48d-febe-4a74-a173-5d68e8423ce3

📥 Commits

Reviewing files that changed from the base of the PR and between 526767b and 29a179d.

📒 Files selected for processing (27)
  • Tests/array.cc
  • Tests/dynarray.cc
  • Tests/dyndlist.cc
  • Tests/dynlist.cc
  • Tests/dynsethash.cc
  • ah-dry.H
  • archeap.H
  • graph-dry.H
  • hashDry.H
  • htlist.H
  • quadtree.H
  • ringfilecache.H
  • tpl_array.H
  • tpl_arrayQueue.H
  • tpl_arrayStack.H
  • tpl_dynArray.H
  • tpl_dynBinHeap.H
  • tpl_dynDlist.H
  • tpl_dynSetHash.H
  • tpl_dynSetTree.H
  • tpl_dynSkipList.H
  • tpl_dyn_slist_nc.H
  • tpl_graph.H
  • tpl_hash.H
  • tpl_lhash.H
  • tpl_linHash.H
  • tpl_memArray.H

Comment thread ringfilecache.H Outdated
Comment thread tpl_dynBinHeap.H Outdated
@lrleon lrleon changed the title Add clean Implement clear() and contains() functionality across data structures Mar 28, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 28, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
Tests/quadtree_test.cc (1)

178-188: Consider adding edge case coverage for clear() on an empty tree.

The test validates the basic clear() behavior on a populated tree. To align with the test coverage guidelines, consider also testing:

  1. clear() on an already-empty tree (no-op behavior)
  2. Re-insertion after clear() to confirm tree remains functional

This mirrors the pattern used in Tests/ringfilecache.cc where both populated and empty states are validated.

💡 Suggested additions
 TEST(QuadTreeBasic, ClearYieldsSameStateAsEmpty)
 {
   QuadTree tree(0, 100, 0, 100, 4);
   tree.insert(Point(25, 25));
   tree.insert(Point(75, 75));
   
   tree.clear();
   
   EXPECT_EQ(tree.search(Point(25, 25)), nullptr);
   EXPECT_EQ(tree.search(Point(75, 75)), nullptr);
+
+  // Verify tree is still usable after clear
+  Point * p = tree.insert(Point(50, 50));
+  EXPECT_NE(p, nullptr);
+  EXPECT_NE(tree.search(Point(50, 50)), nullptr);
+
+  // Clear on already-empty tree should be a no-op
+  tree.clear();
+  tree.clear();
+  EXPECT_EQ(tree.search(Point(50, 50)), nullptr);
 }

As per coding guidelines: "Tests must cover edge cases: empty inputs, single element, large inputs."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Tests/quadtree_test.cc` around lines 178 - 188, Add edge-case assertions
around QuadTree::clear by adding a test that calls clear() on a newly
constructed QuadTree (QuadTree tree(0, 100, 0, 100, 4)) and verifies
search(Point(...)) returns nullptr (no-op behavior), and then test re-insertion
after clear by inserting a Point, calling clear(), inserting again with
QuadTree::insert and verifying search returns non-null for the re-inserted
point; reference QuadTree, clear(), insert(), and search() to locate where to
extend Tests/quadtree_test.cc.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@htlist.H`:
- Around line 1711-1718: The Doxygen block for the member function clear()
noexcept incorrectly contains an `@param` tag for a non-existent parameter; remove
the line containing "@param none" (or replace it with a different applicable tag
such as a brief/note) so there are no `@param` entries for the parameterless
function clear(), leaving the `@brief` and `@return` lines (or removing `@return` void
if you prefer minimal docs) intact; locate the comment associated with the
clear() method (which delegates to empty()) and update it to eliminate the
`@param` none entry to avoid Doxygen warnings.

In `@tpl_dyn_slist_nc.H`:
- Around line 84-91: The Doxygen for Dyn_Slist_Nc::clear() incorrectly uses
"@param none" for a parameterless method; remove the "@param none" line from the
comment block for clear() (while keeping `@brief`, `@return` void and `@throws` none)
so the comment conforms to the guideline and produces no Doxygen warnings;
locate the clear() docblock in tpl_dyn_slist_nc.H and update it accordingly.

In `@tpl_graph.H`:
- Around line 2826-2833: The Doxygen block for Path::clear() incorrectly uses
"@param none" for a no-argument method which causes warnings; remove the "@param
none" tag from the comment above void clear() (keep the existing `@brief`, `@return`
void, and `@throws` none tags or adapt them to match project style) so the
docblock contains no `@param` entry for clear(), ensuring Doxygen emits no
warnings for this file.

---

Nitpick comments:
In `@Tests/quadtree_test.cc`:
- Around line 178-188: Add edge-case assertions around QuadTree::clear by adding
a test that calls clear() on a newly constructed QuadTree (QuadTree tree(0, 100,
0, 100, 4)) and verifies search(Point(...)) returns nullptr (no-op behavior),
and then test re-insertion after clear by inserting a Point, calling clear(),
inserting again with QuadTree::insert and verifying search returns non-null for
the re-inserted point; reference QuadTree, clear(), insert(), and search() to
locate where to extend Tests/quadtree_test.cc.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 17955a3b-f429-42b3-9cbb-cd3b9c03b77c

📥 Commits

Reviewing files that changed from the base of the PR and between 29a179d and ae7d90b.

📒 Files selected for processing (29)
  • Tests/array.cc
  • Tests/quadtree_test.cc
  • Tests/ringfilecache.cc
  • ah-dry.H
  • archeap.H
  • graph-dry.H
  • hashDry.H
  • htlist.H
  • quadtree.H
  • ringfilecache.H
  • tpl_array.H
  • tpl_arrayQueue.H
  • tpl_arrayStack.H
  • tpl_dynArray.H
  • tpl_dynBinHeap.H
  • tpl_dynDlist.H
  • tpl_dynListQueue.H
  • tpl_dynListStack.H
  • tpl_dynSetHash.H
  • tpl_dynSetTree.H
  • tpl_dynSkipList.H
  • tpl_dyn_slist_nc.H
  • tpl_graph.H
  • tpl_hash.H
  • tpl_lhash.H
  • tpl_linHash.H
  • tpl_memArray.H
  • tpl_odhash.H
  • tpl_olhash.H
✅ Files skipped from review due to trivial changes (2)
  • tpl_dynListQueue.H
  • tpl_dynListStack.H
🚧 Files skipped from review as they are similar to previous changes (13)
  • quadtree.H
  • tpl_dynBinHeap.H
  • tpl_array.H
  • hashDry.H
  • tpl_dynDlist.H
  • Tests/array.cc
  • tpl_memArray.H
  • tpl_linHash.H
  • archeap.H
  • tpl_lhash.H
  • tpl_arrayStack.H
  • tpl_hash.H
  • tpl_dynSetHash.H
👮 Files not reviewed due to content moderation or server errors (7)
  • tpl_dynArray.H
  • tpl_odhash.H
  • tpl_arrayQueue.H
  • tpl_olhash.H
  • ah-dry.H
  • tpl_dynSkipList.H
  • tpl_dynSetTree.H

Comment thread htlist.H
Comment thread tpl_dyn_slist_nc.H Outdated
Comment thread tpl_graph.H
Copilot AI review requested due to automatic review settings March 28, 2026 20:35
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tpl_dyn_slist_nc.H (1)

89-96: Remove invalid @param none and consider adding noexcept.

Two issues with the new clear() method:

  1. @param none is invalid Doxygen syntax for parameterless methods - remove this line.
  2. The sibling DynSlist::clear() is marked noexcept. For consistency and to signal that clear() doesn't throw, consider adding noexcept.
Proposed fix
-    /** `@brief` Alias for empty(). 
-        
-        `@param` none
-        `@return` void
-        `@throws` none
-        `@see` empty()
-    */
-    void clear() { empty(); }
+    /** `@brief` Alias for empty().
+     *
+     *  `@return` void
+     *  `@throws` none
+     *  `@see` empty()
+     */
+    void clear() noexcept { empty(); }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tpl_dyn_slist_nc.H` around lines 89 - 96, Remove the invalid Doxygen "@param
none" line from the clear() comment and mark the clear() method as noexcept to
match the sibling DynSlist::clear(); specifically update the documentation block
for clear() (which currently references empty()) by deleting the "@param none"
entry and change the method signature void clear() { empty(); } to a noexcept
version (e.g., void clear() noexcept { empty(); }) so the declaration and docs
reflect that it cannot throw.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tpl_dyn_slist_nc.H`:
- Line 196: The method top() is declared const but calls the non-const
get_first(), causing const-correctness compilation errors; either remove const
from top() or (preferable) add a const overload of get_first() that can be
called on const Dyn_Slist_Nc objects (e.g., get_first() const returning const
T&) and keep top() as T top() const forwarding to that const get_first(); update
the get_first() declarations/definitions and any callers accordingly so const
Dyn_Slist_Nc instances compile.

---

Nitpick comments:
In `@tpl_dyn_slist_nc.H`:
- Around line 89-96: Remove the invalid Doxygen "@param none" line from the
clear() comment and mark the clear() method as noexcept to match the sibling
DynSlist::clear(); specifically update the documentation block for clear()
(which currently references empty()) by deleting the "@param none" entry and
change the method signature void clear() { empty(); } to a noexcept version
(e.g., void clear() noexcept { empty(); }) so the declaration and docs reflect
that it cannot throw.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 06c76c7c-e033-4e64-848d-761cdb2546a6

📥 Commits

Reviewing files that changed from the base of the PR and between ae7d90b and 18d364d.

📒 Files selected for processing (5)
  • graph-dry.H
  • htlist.H
  • tpl_array.H
  • tpl_dynDlist.H
  • tpl_dyn_slist_nc.H
🚧 Files skipped from review as they are similar to previous changes (4)
  • tpl_dynDlist.H
  • tpl_array.H
  • graph-dry.H
  • htlist.H

Comment thread tpl_dyn_slist_nc.H Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 32 comments.

Comment thread tpl_hash.H
Comment thread tpl_dynSetHash.H Outdated
Comment thread tpl_dynListStack.H
Comment thread tpl_dynListQueue.H Outdated
Comment thread tpl_arrayStack.H
Comment thread tpl_dynSkipList.H Outdated
Comment thread tpl_dynSetTree.H Outdated
Comment thread tpl_dynDlist.H Outdated
Comment thread tpl_dynBinHeap.H
Comment thread tpl_arrayQueue.H Outdated
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 28, 2026
- Elimina anotaciones redundantes '@param none' y '@return void' en métodos clear() de múltiples contenedores (tpl_arrayStack.H, tpl_dynListStack.H, tpl_dynArray.H, archeap.H, hashDry.H, tpl_arrayQueue.H, tpl_array.H, tpl_hash.H, tpl_dynSetHash.H, tpl_graph.H, htlist.H, tpl_lhash.H, tpl_dynSetTree.H, tpl_dyn_slist_nc.H, tpl_linHash.H, tpl_dynListQueue.H, tpl_dynBinHeap.H, ringfilecache.H, tpl_dynSkipList.H, tpl_memArray.H, tpl_dynDlist.H).
- Corrige 'searching criteria' a 'searching criterion' en ah-dry.H para consistencia gramatical.
- Añade métodos const get_next() y get_data() en slink_nc.H y tpl_snode_nc.H.
- Corrige formato LaTeX en tpl_polynomial.H y README.md.
- Añade pruebas de casos límite en Tests/quadtree_test.cc.
- Mejora documentación de graph-dry.H eliminando '@param none' innecesario.
- Corrige enlaces y formato en README.md y README.es.md.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tpl_dyn_slist_nc.H (1)

74-123: ⚠️ Potential issue | 🟡 Minor

Should fix: complete the Doxygen for the newly exposed public methods.

Several changed public methods still do not match the repository's documentation contract. Examples: empty()/clear() omit @return, the queue/stack helpers omit applicable @return/@throws tags, operator[] omits @throws, and the updated accessor blocks still use @throw instead of the repo's required @throws.

Based on learnings, “All public member functions must have brief, param, return, and throws Doxygen tags” and “No Doxygen warnings for changed files in code review.”

Also applies to: 134-182, 195-236, 303-325

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tpl_dyn_slist_nc.H` around lines 74 - 123, Public method Doxygen is
incomplete/inconsistent: update the docs for empty(), clear(), insert(),
append(), operator[] and the accessor blocks to include `@brief`, `@param` (where
applicable), `@return` (for functions returning a value or reference) and `@throws`
(use `@throws` everywhere — replace any `@throw`) to match the repo contract;
specifically add an explicit "@return void" or appropriate "@return reference to
..." for empty()/clear()/insert()/append()/operator[] and add "@throws
std::bad_alloc" (or the correct exception) where allocations or bounds errors
may occur, and ensure accessor blocks use `@throws` not `@throw` so no Doxygen
warnings are produced (look for symbols empty, clear, insert, append,
operator[], and the accessor methods mentioned).
tpl_snode_nc.H (1)

62-93: ⚠️ Potential issue | 🟡 Minor

Should fix — finish Doxygen on these const overloads and the updated iterator accessor.

The API additions themselves look fine, but this changed public surface still does not meet the header documentation contract: the new const overloads are missing the complexity/precondition notes, and Iterator::get_curr() still only has a brief inline comment.

As per coding guidelines, "All public member functions must have @brief, @param, @return, and @throws Doxygen tags", "Include time/space complexity in function documentation as @note or in description", and "Document preconditions (@pre) and postconditions (@post) when relevant".

Also applies to: 118-120

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tpl_snode_nc.H` around lines 62 - 93, Update the missing Doxygen for the
newly added const overloads and the iterator accessor: add full Doxygen blocks
for const T & get_data() const, const Snode_Nc * get_next() const, Snode_Nc *
remove_next(), Snode_Nc *& get_next(), and Iterator::get_curr() that include
`@brief`, `@return`, and `@throws` (even if "none"); add `@note` with time/space
complexity (e.g., O(1) for pointer ops) and include `@pre/`@post where relevant
(e.g., precondition that next exists for remove_next(), postcondition about
returned pointer and list linkage), keeping wording consistent with the
project's doc style.
♻️ Duplicate comments (1)
ringfilecache.H (1)

870-875: ⚠️ Potential issue | 🟡 Minor

Complete the Doxygen contract for clear() by adding @return.

Line 870 introduces docs for a new public API, but the block still misses @return, which is required by this repository’s public-method doc contract.

Proposed doc patch
   /** `@brief` Removes all entries from the cache.
+      `@return` void
 
       `@throws` none
 
       `@note` This method is an alias for empty() and is noexcept.
   */

As per coding guidelines, "All public member functions must have @brief, @param, @return, and @throws Doxygen tags."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ringfilecache.H` around lines 870 - 875, The Doxygen for the public method
clear() is missing a `@return` tag; update the documentation for clear() (the
public noexcept alias of empty()) to include an `@return` describing what callers
receive (e.g., "void" or "Nothing; the cache will be empty after the call")
consistent with the repo contract, and keep existing `@brief` and `@throws` entries
and the note that it is an alias for empty() and is noexcept.
🧹 Nitpick comments (1)
Tests/quadtree_test.cc (1)

194-204: Make ClearYieldsSameStateAsEmpty compare clear() vs empty() explicitly.

Line 194 names an equivalence claim, but the body only verifies lookup misses after clear(). Add side-by-side assertions against a tree cleared with empty().

♻️ Suggested test tightening
 TEST(QuadTreeBasic, ClearYieldsSameStateAsEmpty)
 {
-  QuadTree tree(0, 100, 0, 100, 4);
-  tree.insert(Point(25, 25));
-  tree.insert(Point(75, 75));
+  QuadTree tree_clear(0, 100, 0, 100, 4);
+  QuadTree tree_empty(0, 100, 0, 100, 4);
+  tree_clear.insert(Point(25, 25));
+  tree_clear.insert(Point(75, 75));
+  tree_empty.insert(Point(25, 25));
+  tree_empty.insert(Point(75, 75));
   
-  tree.clear();
+  tree_clear.clear();
+  tree_empty.empty();
   
-  EXPECT_EQ(tree.search(Point(25, 25)), nullptr);
-  EXPECT_EQ(tree.search(Point(75, 75)), nullptr);
+  EXPECT_EQ(tree_clear.search(Point(25, 25)), tree_empty.search(Point(25, 25)));
+  EXPECT_EQ(tree_clear.search(Point(75, 75)), tree_empty.search(Point(75, 75)));
+  EXPECT_NE(tree_clear.get_root(), nullptr);
 }
Based on learnings: "Tests must verify algorithmic correctness, not just absence of crashes."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Tests/quadtree_test.cc` around lines 194 - 204, The test
QuadTreeBasic::ClearYieldsSameStateAsEmpty only checks that search returns
nullptr after tree.clear(), but doesn't verify that the cleared tree's state
equals a freshly empty tree; modify the test to create a second QuadTree
constructed the same way and call its empty() (or ensure it's in the empty
state), then assert that both trees behave identically: compare that
search(Point(25,25)) and search(Point(75,75)) are nullptr for both trees and, if
available, compare any public state/query results (e.g. size(), isEmpty(), or
bounding-node structure) between the tree after clear() and the freshly empty
QuadTree to ensure clear() yields the same state as empty(); use the QuadTree
constructor, clear(), empty(), and search() identifiers to locate where to add
the side-by-side assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ah-dry.H`:
- Around line 543-549: Update the Doxygen throws contract for the membership
APIs: remove the incorrect "@throws none" and instead document that contains_if
may propagate exceptions thrown by the predicate (when the predicate is not
noexcept) and contains may propagate exceptions from operator==; apply the same
change to the related comment block for contains (the later block around lines
557-562) and use the function names contains_if and contains in the text so the
intent is clear.
- Around line 551-555: The const contains_if currently forwards its Operation
via std::forward which can select the non-const find_ptr and permit mutation;
fix it by forcing the const overload of find_ptr: change the const contains_if
to pass a const reference to the predicate (e.g. accept or cast to const
Operation& and call find_ptr(static_cast<const Operation&>(operation)) or simply
use std::as_const(operation)) instead of std::forward, so find_ptr's const path
is used and predicates cannot mutate the container.

In `@htlist.H`:
- Around line 1407-1411: The Doxygen for the new public member function clear()
is missing an `@return` tag; update the comment block for clear() to include
"@return void" (or equivalent text stating it returns nothing) while keeping the
existing `@brief` and "@throws none" lines and omitting any `@param` (since clear()
has no parameters) so the public API doc meets the requirement that all public
member functions include `@brief`, `@param`, `@return`, and `@throws` tags.

In `@slink_nc.H`:
- Around line 103-111: Update the public API documentation for the
iterator/accessor methods (get_next(), get_curr_ne(), get_curr(), next()) by
replacing terse inline comments with full Doxygen blocks that include `@brief`,
`@param` (if any), `@return`, `@throws` (use "none" when nothing is thrown), and add
complexity notes (`@note`) for time/space, plus `@pre/`@post conditions where
relevant (e.g., pointer non-null or iterator validity). Ensure get_next()'s
contract documents that it returns a const pointer to the next Slink_Nc,
asserts/non-null precondition, O(1) time, no exceptions, and any postconditions;
apply the same style and level of detail to get_curr_ne(), get_curr(), and
next() so all public members meet the project's required tags and wording
conventions.

In `@tpl_array.H`:
- Around line 336-340: Update the Doxygen block for the public method clear() to
include the missing required tags: add an `@param` none (or `@param`[in] none) entry
to denote there are no parameters, add an `@return` void line to document the
return type, and add `@throws` none to explicitly state no exceptions are thrown;
keep the existing `@brief` and `@see` empty() lines intact so the clear()
documentation satisfies the project's rule that all public members include
`@brief`, `@param`, `@return`, and `@throws`.
- Around line 336-341: The new public method clear() lacks unit tests and its
Doxygen is missing the required `@return` tag; add "@return void" to the clear()
Doxygen block (keeping `@brief` and `@throws` none) and add unit tests for clear()
that exercise: call clear() on a populated container and assert size() == 0 and
is_empty() == true, call clear() on an already empty container and assert it is
safe (no throw) and still size() == 0 and is_empty() == true, and include any
necessary setup/teardown to create a non-empty instance before clearing;
reference the clear(), size(), and is_empty() members when adding tests.

In `@tpl_dyn_slist_nc.H`:
- Around line 47-55: The Doxygen for Dyn_Slist_Nc<T> currently only names the
type parameter; update the class comment to document the semantic requirements
on T: state that T must be Destructible and CopyConstructible (or generally
Copyable) because operations like insert(), append(), copy
construction/assignment of the container, and element destruction rely on those
properties; mention any exceptions (e.g. noexcept or move-only not supported)
and where relevant reference the class name Dyn_Slist_Nc<T> and the member
functions insert() and append() so readers can find the constraints.
- Around line 319-325: The const operator[] implementation must explicitly check
bounds before returning; in operator[] const (and mirror in the non-const
overload) verify that the requested index n is within range by walking the
Iterator or checking has_curr and then call ah_range_error_if(condition) when n
>= num_items (or when the iterator runs out) so you raise a deterministic range
error instead of unconditionally returning it.get_curr(); update the code around
Iterator it(...), the loop, and the final return to perform this check and
invoke ah_range_error_if(...) on out-of-range before calling it.get_curr().

In `@tpl_dynDlist.H`:
- Around line 164-170: The Doxygen block for the public method clear() is
missing mandatory tags; update the comment for clear() (which calls empty()) to
include `@return` describing the state after call (e.g., "void; container will be
empty") and an `@throws` tag (e.g., "none" or list exceptions if empty() can
throw) so it complies with the repo rule requiring `@brief`, `@param`, `@return`, and
`@throws` for all public members; reference the clear() method and its aliasing to
empty() to ensure the `@throws` text matches empty()'s exception guarantees.

In `@tpl_memArray.H`:
- Around line 346-359: Add explicit `@return` Doxygen tags to the two public
methods empty() and clear(): update the empty() comment block to include
"@return void" (or equivalent text) and update the clear() comment block to
include "@return void" as well, keeping existing `@brief` and `@throws` lines and
the `@see` in clear(); ensure tags follow the repository's Doxygen style for
public member functions.
- Around line 354-359: Add a GTest for the new public MemArray::clear() that
verifies its contract: create a MemArray<T>, populate it (or reserve and push
elements), record pre-clear capacity/allocated state (e.g., capacity() or
pointer/data presence), call clear(), then assert MemArray::empty() is true and
size()==0 while capacity (or allocation pointer) is preserved (unchanged or
non-null as expected); also include a test case where clear() is noexcept (call
in noexcept context or static_assert if applicable) and one that clears an
already-empty MemArray to cover the pre/postconditions. Use the MemArray
constructor, clear(), empty(), size(), capacity() and any
data()/buffer-identifying accessors from the class to make the assertions.

---

Outside diff comments:
In `@tpl_dyn_slist_nc.H`:
- Around line 74-123: Public method Doxygen is incomplete/inconsistent: update
the docs for empty(), clear(), insert(), append(), operator[] and the accessor
blocks to include `@brief`, `@param` (where applicable), `@return` (for functions
returning a value or reference) and `@throws` (use `@throws` everywhere — replace
any `@throw`) to match the repo contract; specifically add an explicit "@return
void" or appropriate "@return reference to ..." for
empty()/clear()/insert()/append()/operator[] and add "@throws std::bad_alloc"
(or the correct exception) where allocations or bounds errors may occur, and
ensure accessor blocks use `@throws` not `@throw` so no Doxygen warnings are
produced (look for symbols empty, clear, insert, append, operator[], and the
accessor methods mentioned).

In `@tpl_snode_nc.H`:
- Around line 62-93: Update the missing Doxygen for the newly added const
overloads and the iterator accessor: add full Doxygen blocks for const T &
get_data() const, const Snode_Nc * get_next() const, Snode_Nc * remove_next(),
Snode_Nc *& get_next(), and Iterator::get_curr() that include `@brief`, `@return`,
and `@throws` (even if "none"); add `@note` with time/space complexity (e.g., O(1)
for pointer ops) and include `@pre/`@post where relevant (e.g., precondition that
next exists for remove_next(), postcondition about returned pointer and list
linkage), keeping wording consistent with the project's doc style.

---

Duplicate comments:
In `@ringfilecache.H`:
- Around line 870-875: The Doxygen for the public method clear() is missing a
`@return` tag; update the documentation for clear() (the public noexcept alias of
empty()) to include an `@return` describing what callers receive (e.g., "void" or
"Nothing; the cache will be empty after the call") consistent with the repo
contract, and keep existing `@brief` and `@throws` entries and the note that it is
an alias for empty() and is noexcept.

---

Nitpick comments:
In `@Tests/quadtree_test.cc`:
- Around line 194-204: The test QuadTreeBasic::ClearYieldsSameStateAsEmpty only
checks that search returns nullptr after tree.clear(), but doesn't verify that
the cleared tree's state equals a freshly empty tree; modify the test to create
a second QuadTree constructed the same way and call its empty() (or ensure it's
in the empty state), then assert that both trees behave identically: compare
that search(Point(25,25)) and search(Point(75,75)) are nullptr for both trees
and, if available, compare any public state/query results (e.g. size(),
isEmpty(), or bounding-node structure) between the tree after clear() and the
freshly empty QuadTree to ensure clear() yields the same state as empty(); use
the QuadTree constructor, clear(), empty(), and search() identifiers to locate
where to add the side-by-side assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bc651780-b01f-400d-a5c5-d0ccccc69d70

📥 Commits

Reviewing files that changed from the base of the PR and between 18d364d and 96bb2e0.

📒 Files selected for processing (29)
  • README.es.md
  • README.md
  • Tests/quadtree_test.cc
  • ah-dry.H
  • archeap.H
  • graph-dry.H
  • hashDry.H
  • htlist.H
  • ringfilecache.H
  • slink_nc.H
  • tpl_array.H
  • tpl_arrayQueue.H
  • tpl_arrayStack.H
  • tpl_dynArray.H
  • tpl_dynBinHeap.H
  • tpl_dynDlist.H
  • tpl_dynListQueue.H
  • tpl_dynListStack.H
  • tpl_dynSetHash.H
  • tpl_dynSetTree.H
  • tpl_dynSkipList.H
  • tpl_dyn_slist_nc.H
  • tpl_graph.H
  • tpl_hash.H
  • tpl_lhash.H
  • tpl_linHash.H
  • tpl_memArray.H
  • tpl_polynomial.H
  • tpl_snode_nc.H
✅ Files skipped from review due to trivial changes (8)
  • tpl_polynomial.H
  • tpl_dynBinHeap.H
  • archeap.H
  • graph-dry.H
  • tpl_dynListQueue.H
  • tpl_dynSkipList.H
  • README.es.md
  • README.md
🚧 Files skipped from review as they are similar to previous changes (9)
  • tpl_dynListStack.H
  • tpl_arrayQueue.H
  • tpl_lhash.H
  • tpl_arrayStack.H
  • tpl_linHash.H
  • hashDry.H
  • tpl_dynSetTree.H
  • tpl_hash.H
  • tpl_dynSetHash.H

Comment thread ah-dry.H
Comment thread ah-dry.H
Comment thread htlist.H
Comment thread slink_nc.H Outdated
Comment thread tpl_array.H
Comment thread tpl_dyn_slist_nc.H
Comment thread tpl_dyn_slist_nc.H
Comment thread tpl_dynDlist.H Outdated
Comment thread tpl_memArray.H Outdated
Comment thread tpl_memArray.H Outdated
- Formatea código para consistencia de espacios y alineación
- Añade documentación faltante en métodos clear() y empty()
- Corrige firmas de métodos para aceptar SearchLimits por referencia constante
- Añade chequeo de límites en operador [] de Dyn_Slist_Nc
- Actualiza especificaciones de excepciones en ah-dry.H
- Mejora claridad de comentarios en slink_nc.H y tpl_snode_nc.H
- Añade prueba unitaria para método clear() en MemArray
Copilot AI review requested due to automatic review settings March 29, 2026 15:50
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
tpl_dyn_slist_nc.H (1)

93-98: noexcept consistency: clear() delegates to non-noexcept empty().

clear() is declared noexcept but calls empty() which lacks the noexcept specifier. If any operation in empty() throws (e.g., a non-conforming destructor), std::terminate() will be called.

For consistency, either mark empty() as noexcept as well (since its documentation already states @throws none), or remove noexcept from clear().

Suggested fix: mark empty() as noexcept
     /** `@brief` Empties the container. 
         
         `@throws` none
     */
-    void empty()
+    void empty() noexcept
     {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tpl_dyn_slist_nc.H` around lines 93 - 98, clear() is declared noexcept but
calls empty() which is not noexcept; update the declaration and definition of
empty() to add the noexcept specifier (since its docs say "@throws none") so
both functions are consistently noexcept, or alternatively remove noexcept from
clear() if empty() cannot be guaranteed non-throwing—prefer adding noexcept to
empty() (function name: empty(), caller: clear()) and rebuild to ensure no
compiler errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tpl_dyn_slist_nc.H`:
- Around line 313-335: The loop variable in both operator[] and its const
version uses a signed int (int i) while comparing to a size_t n, risking
signed/unsigned mismatch and overflow; change the loop counter to an unsigned
type matching n (e.g., size_t i) in the functions operator[](size_t const& n)
and the const overload (where Iterator it is constructed), so the for loops use
size_t i = 0; i < n; ++i, it.next_ne() to avoid undefined behavior for large
indices.

In `@tpl_dynDlist.H`:
- Around line 156-162: The Doxygen wrongly claims "This is an alias of empty()";
update the comment for the method (replace that line) to describe the actual
behavior — e.g., state that the function removes all elements from the
container, leaves it empty (size() == 0), and resets internal state; if the
intent was to note equivalence to empty() mention "performs the same result as
empty()" rather than "is an alias of empty()". Ensure references to empty()
remain accurate in the comment for clarity.

---

Nitpick comments:
In `@tpl_dyn_slist_nc.H`:
- Around line 93-98: clear() is declared noexcept but calls empty() which is not
noexcept; update the declaration and definition of empty() to add the noexcept
specifier (since its docs say "@throws none") so both functions are consistently
noexcept, or alternatively remove noexcept from clear() if empty() cannot be
guaranteed non-throwing—prefer adding noexcept to empty() (function name:
empty(), caller: clear()) and rebuild to ensure no compiler errors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d6367c2a-2ede-40fd-8d39-ce9c101bf567

📥 Commits

Reviewing files that changed from the base of the PR and between 96bb2e0 and 21756d5.

📒 Files selected for processing (17)
  • Alpha_Beta.H
  • Backtracking.H
  • Branch_And_Bound.H
  • Examples/adversarial_artificial_example.cc
  • Negamax.H
  • State_Search_IDA_Star.H
  • Tests/memarray.cc
  • ah-dry.H
  • htlist.H
  • search_move_ordering.H
  • slink_nc.H
  • tpl_array.H
  • tpl_arrayQueue.H
  • tpl_dynDlist.H
  • tpl_dyn_slist_nc.H
  • tpl_memArray.H
  • tpl_snode_nc.H
✅ Files skipped from review due to trivial changes (2)
  • Tests/memarray.cc
  • tpl_array.H
🚧 Files skipped from review as they are similar to previous changes (4)
  • slink_nc.H
  • tpl_snode_nc.H
  • tpl_memArray.H
  • tpl_arrayQueue.H

Comment thread tpl_dyn_slist_nc.H
Comment thread tpl_dynDlist.H
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 4 comments.

Comment thread tpl_memArray.H
Comment thread tpl_dynDlist.H Outdated
Comment thread tpl_dynSetHash.H
Comment thread ah-dry.H Outdated
Se cambia la condición del bucle en el constructor de copia de tpl_memArray.H de `i < dim` a `i < n` para copiar el número correcto de elementos.

refactor: Simplifica llamadas y corrige tipos en contenedores

- En ah-dry.H, se elimina `std::as_const` innecesario en `contains_if`.
- En tpl_dyn_slist_nc.H, se cambia el tipo del índice en bucles de `int` a `size_t`.
- En tpl_array.H y htlist.H, se eliminan comentarios redundantes `@return void`.
- En tpl_dynSetHash.H, se reemplaza `this->HashTable<Key, Cmp>::contains(key)` por `Base::contains(key)`.
- En tpl_dynDlist.H, se mejora la documentación de `empty()` y se simplifica `clear()`.
@lrleon lrleon merged commit f015a00 into master Mar 29, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants