Skip to content

Add ranges::{starts,ends}_with#2618

Merged
akukanov merged 12 commits into
mainfrom
dev/ranges-starts-ends-with-akukanov
Apr 28, 2026
Merged

Add ranges::{starts,ends}_with#2618
akukanov merged 12 commits into
mainfrom
dev/ranges-starts-ends-with-akukanov

Conversation

@akukanov
Copy link
Copy Markdown
Contributor

@akukanov akukanov commented Mar 16, 2026

The implementations of ranges::starts_/ends_with redirect to mismatch and equal respectively, as described in the C++ standard.

@akukanov akukanov added this to the 2022.13.0 milestone Mar 16, 2026
@akukanov akukanov force-pushed the dev/ranges-starts-ends-with-akukanov branch 2 times, most recently from bd94959 to 928c7f5 Compare March 19, 2026 14:34
@akukanov akukanov force-pushed the dev/ranges-starts-ends-with-akukanov branch from 928c7f5 to 5625aa6 Compare March 25, 2026 12:36
Comment thread include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h Outdated
@akukanov akukanov force-pushed the dev/ranges-starts-ends-with-akukanov branch from 5625aa6 to 7cbc809 Compare April 13, 2026 17:54
Comment thread include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h Outdated
Comment thread include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h Outdated
@akukanov akukanov force-pushed the dev/ranges-starts-ends-with-akukanov branch from e997c1c to cfe72b5 Compare April 22, 2026 16:43
Copy link
Copy Markdown
Contributor

@dmitriy-sobolev dmitriy-sobolev left a comment

Choose a reason for hiding this comment

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

LGTM

@dmitriy-sobolev dmitriy-sobolev dismissed their stale review April 23, 2026 10:54

Removing the approval because of this clang-format complaints:

-    auto begin() const
+    auto
+    begin() const
     {
         return __begin(__r) + __n;
     }
 
-    auto end() const
+    auto
+    end() const
     {
         return __end(__r);
     }

and optionally this one:

-} // __internal
+} // namespace __internal
Comment thread include/oneapi/dpl/pstl/glue_algorithm_ranges_defs.h
@akukanov akukanov force-pushed the dev/ranges-starts-ends-with-akukanov branch from 173fd07 to 0be6f8f Compare April 23, 2026 13:47
Copy link
Copy Markdown
Contributor

@dmitriy-sobolev dmitriy-sobolev left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread include/oneapi/dpl/pstl/onedpl_config.h Outdated
Comment thread include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h Outdated
@dmitriy-sobolev dmitriy-sobolev dismissed their stale review April 28, 2026 14:25

Retracting my approval due to Sergey's finding.

        using _DistanceType = std::ranges::range_difference_t<_R1>;
        _DistanceType __n1 = std::ranges::distance(__r1);
        _DistanceType __n2 = std::ranges::distance(__r2); // <- May truncate __n2

        if (__n1 < __n2) // <- this check will not work properly if __n2 is truncated. 
            return false;
Comment thread include/oneapi/dpl/pstl/glue_algorithm_ranges_impl.h
Copy link
Copy Markdown
Contributor

@SergeyKopienko SergeyKopienko left a comment

Choose a reason for hiding this comment

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

LGTM

@akukanov akukanov merged commit ec5c7ca into main Apr 28, 2026
22 of 23 checks passed
@akukanov akukanov deleted the dev/ranges-starts-ends-with-akukanov branch April 28, 2026 19:32
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.

5 participants