C++ Logo


Advanced search

Re: Review Request: Proposal Ternary Right Fold Expression (P1012)

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Thu, 11 Jun 2020 15:15:41 -0400
On Thu, Jun 11, 2020 at 2:29 PM Frank Zingsheim via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> I have added a paragraph "Comparison to Alternatives already available in
> C++17"
> This paragraph contains a comparison of the fold conditional operator
> to a recursive definition as well as to the usage of the fold with
> operator|| trick.

Section IV contains two code snippets (A and B) that are similar to each
other, and use f<is>() instead of a realistic example.
Section V contains three code snippets that are similar to each other, and
use a realistic example instead of f<is>().
I think you should
- combine section IV into section V (and rewrite IV's examples to use your
realistic `translators` example)
- subdivide section V into V.A, V.B, V.C, V.D, V.E for ease of linking and

(2) You say "initial value" several times when you mean "final value".

(3) It would be nice if your footnotes [1], [2], [3]... were hyperlinks.

(4) Your sample code does not compile.

[[noreturn]] void unknown_language(
    std::string_view language)
    throw std::invalid_argument("Unknown language: " + language);

You can't `+` a char pointer and a string_view like that.
Please make each of your examples a complete, correct, compilable example —
except of course for the ones that depend on the new core feature. For
those, make as sure as you possibly can that they are "complete, correct,
and compilable" in this future world where ternary folds are supported.
(Ideally, you'd modify Clang to support ternary folds, and then make sure
that your code was compilable with your modded Clang.) One good way to
make sure your code is compilable is: Every time you give a code snippet,
start with a comment of the form

    // https://godbolt.org/z/9vabZp

where the Godbolt link goes to a copy of that exact code.


Received on 2020-06-11 14:20:22