Skip to content

<ranges>: iota_view and _Counted_fn inconsistently use _STL_ASSERT for precondition checking #4586

Description

Currently, there're two styles of precondition checking in <ranges>.

  1. _STL_ASSERT, used only by iota_view and _Counted_fn.
  2. _STL_VERIFY guarded by _CONTAINER_DEBUG_LEVEL > 0.
  3. _STL_VERIFY guarded by _ITERATOR_DEBUG_LEVEL != 0.

It's unclear to me why there're both != 0 and > 0.

It seems that "_STL_VERIFY guarded by _ITERATOR_DEBUG_LEVEL != 0" is intendedly used for iterator-related checking, and "_STL_VERIFY guarded by _CONTAINER_DEBUG_LEVEL > 0" and _STL_ASSERT are used for other preconditions.

Should we consistently use one style for checking preconditions that are not directly related to iterators?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething can be improvedfixedSomething works now, yay!rangesC++20/23 ranges

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions