Date: Tue, 9 Dec 2025 10:55:29 +0200
On Tue, 9 Dec 2025 at 10:51, David Brown via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> void append(iterator b, iterator e) {
> for (auto n = e - b; n; n--, ++b) {
> vec.push_back(*b);
> }
> }
>
> Won't that give the same set of push_back's without needing "e" to
> remain valid?
It does so by completely changing the requirements for the iterators
that code works with. But considering
just the example provided, it indeed doesn't change anything, and does
provide an alternative way
that was claimed to be impossible to write. :)
<std-proposals_at_[hidden]> wrote:
> void append(iterator b, iterator e) {
> for (auto n = e - b; n; n--, ++b) {
> vec.push_back(*b);
> }
> }
>
> Won't that give the same set of push_back's without needing "e" to
> remain valid?
It does so by completely changing the requirements for the iterators
that code works with. But considering
just the example provided, it indeed doesn't change anything, and does
provide an alternative way
that was claimed to be impossible to write. :)
Received on 2025-12-09 08:55:43
