Skip to content

Make sure ranges with integer-like indexes are supported #2606

@dmitriy-sobolev

Description

@dmitriy-sobolev

std::ranges::size() may return an integer-like type, which is not covered by oneDPL tests.

A suggestion:

  1. Add a test with a range with an integer-like type.
  2. Fix issues if any.

Notes:

https://en.cppreference.com/w/cpp/iterator/is-integer-like.html specifies that:

Expressions of integer-class type are explicitly convertible to any integer-like type, and implicitly convertible to any integer-class type of equal or greater width and the same signedness. Expressions of integral type are both implicitly and explicitly convertible to any integer-class type. Conversions between integral and integer-class types and between two integer-class types do not exit via an exception. The result of such a conversion is the unique value of the destination type that is congruent to the source modulo 2N
, where N is the width of the destination type.

Given that the conversion from/to a regular integer type is outlined by the spec, such ranges should already be supported, but explicitly checking is an additional guarantee.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions