Adjoints to "Enabling list-initialization for algorithms": find_last (original) (raw)
Published Proposal, 2024-03-31
Author:
Audience:
LWG, LEWG
Project:
ISO/IEC 14882 Programming Languages — C++, ISO/IEC JTC1/SC22/WG21
Abstract
We extend the same changes that [P2248R8] applied to the rest of the find algorithms to std::ranges::find_last.
Table of Contents
1. Changelog
- R0
- First submission
2. Motivation and scope
In the Tokyo 2024 meeting [P2248R8] was adopted. Due to an oversight (which is entirely our fault) std::ranges::find_last was accidentally excluded from the algorithms for which a default template type parameter for the "value" argument was provided.
We propose to modify find_last’s specification, so that it matches the post-P2248 one for the rest of the algorithms (especially find).
3. Proposed Wording
All the proposed changes are relative to [N4971], assuming that [P2248R8]'s wording has been merged already.
Modify [alg.find.last] as shown:
template<forward_iterator I, sentinel_for S, class T, class Proj = identity, class T = projected_value_t<I, Proj>>
requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
constexpr subrange ranges::find_last(I first, S last, const T& value, Proj proj = {});
template<forward_range R, class T, class Proj = identity, class T = projected_value_t<iterator_t, Proj>>
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t, Proj>, const T*>
constexpr borrowed_subrange_t ranges::find_last(R&& r, const T& value, Proj proj = {});
4. Acknowledgements
Thanks to Jens Maurer for pointing out this oversight of [P2248R8].
Thanks to KDAB for supporting this work.
All remaining errors are ours and ours only.
References
Informative References
[N4971]
Thomas Köppe. Working Draft, Programming Languages — C++. 18 December 2023. URL: https://wg21.link/n4971
[P2248R8]
Giuseppe D'Angelo. Enabling list-initialization for algorithms. URL: https://isocpp.org/files/papers/P2248R8.html