clang 3.6 fold expression left/right

前端 未结 1 1079
[愿得一人]
[愿得一人] 2021-01-05 06:03

I\'m trying the fold expression with clang 3.6 \'--std=c++1z\', but something I don\'t quite get. The function that I\'m testing is:

auto minus = [](auto...          


        
相关标签:
1条回答
  • 2021-01-05 07:00

    n4191 was revised by n4295. According to that, an expression of the form (e op ...) is a unary right fold, and that is expanded as: E1 op (... op (EN-1 op EN)), i.e. as a right fold expansion.

    This does seem to be the reverse of what n4191 stated in terms of the fold direction. Clang 3.6 implements the n4295 proposal, as shown here.

    ... - args would be a unary left fold and expand in the direction you want.

    0 讨论(0)
提交回复
热议问题