Skip to content

Fix const iterator value types - #1495

Open
fzlzjerry wants to merge 1 commit into
jbeder:masterfrom
fzlzjerry:fix/1326-iterator-value-type
Open

Fix const iterator value types#1495
fzlzjerry wants to merge 1 commit into
jbeder:masterfrom
fzlzjerry:fix/1326-iterator-value-type

Conversation

@fzlzjerry

Copy link
Copy Markdown

Description

Make the iterator value_type cv-unqualified so generic code using std::iterator_traits<It>::value_type can collect const YAML ranges into a std::vector.

Keep the existing cv-qualified dereference result for both forward and reverse iterators. Pointer/reference types, iterator categories and Node sharing behavior are unchanged. Changing the value-type alias alone would also remove const from both dereference results; the regression tests cover that distinction.

Validation

  • Five regression tests cover traits/constness, sequence and map collection in both directions, empty ranges and Node identity. They fail to compile on the original base because of std::vector<const iterator_value>.
  • Full CMake/CTest runs pass with GCC 14.2 (C++11-configured Debug and C++20 Release) and Clang 19.1.7 (C++23 shared library with ASan, UBSan and leak detection). The 8 existing disabled tests are unchanged.
  • Standalone consumers compile and run with both compilers in C++11, C++20 and C++23; separate installed-package checks pass for all four iterator modes against each build. The C++11 CMake profile uses C++11 for the library and C++14 for GoogleTest; the standalone C++11 checks use C++11 throughout.
  • Changed-code clang-format, whitespace checks and git diff --check pass.

Closes #1326.

Copilot AI lite review requested due to automatic review settings September 10, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

iterator_base::value_type should not be const

2 participants