C++ 概念 没有 noexcept 和 return-type-requirement 的复合需求与简单需求

C++ Concepts Compound Requirements without noexcept and return-type-requirement vs Simple Requirements

template<class T>
concept C1 = requires(T a, T b) { a + b; };

template<class T>
concept C2 = requires(T a, T b) { { a + b }; };

C1 和 C2 在功能上会有区别吗?

编辑:语法

它们是等价的。标准连 has an example of it:

template<typename T> concept C1 = requires(T x) {
 {x++};
};

The compound-requirement in C1 requires that x++ is a valid expression. It is equivalent to the simple-requirement x++;.

Compound requirements 能够测试表达式的某些方面,例如它是否为 noexcept 或结果类型是否满足某些概念。但是,如果这些测试都不存在,它只是将模板参数替换为表达式,验证其有效性,然后收工。