Title
[tiny] simultaneous iteration with new-style for syntax
Status
open
Section
[stmt.ranged]
Submitter
Gabriel Dos Reis

Created on 2013-01-12.00:00:00 last changed 144 months ago

Messages

Date: 2014-07-01.21:57:43

The new-style 'for' syntax allows us to dispense with administrative iterator declarations when iterating over a single seuqence. The burden and noise remain, however, when iterating over two or more sequences simultaenously. We should extend the syntax to allow that. E.g. one should be able to write:

    for (auto& x : v; auto& y : w)
       a = combine(v, w, a);
instead of the noisier
    auto p1 = v.begin();
    auto q1 = v.end();
    auto p2 = w.begin();
    auto q2 = w.end();
    while (p1 < q1 and p2 < q2) {
       a = combine(*p1, *p2, a);
       ++p1;
       ++p2;
    }

Bristol 2013: Submitter is encouraged to write a paper.

EWG expressed reiterated interest in Chicago 2013 for this idea, deeming it post-C++14 material.

Discussed in Rapperswil 2014. The author is still encouraged to submit a paper. Vandevoorde to contact Dos Reis and Lavavej about it.

History
Date User Action Args
2013-01-12 00:00:00admincreate