相关疑难解决方法(0)

试图理解C++ 14中的[basic.def.odr]/2(N4140)

[basic.def.odr]/2中的示例以下面的句子开头:

在下面的示例中,n的初始值设定项的潜在结果集包含第一个S :: x子表达式,但不包含第二个S :: x子表达式.

从本段的定义中,我们如何推断出n的初始值包含第一个S :: x子表达式,而不是第二个S :: x子表达式?

编辑 请参阅下面上面提到的示例的其余部分:

struct S { static const int x = 0; };
const int &f(const int &r);
int n = b ? (1, S::x) // S::x is not odr-used here
          : f(S::x); // S::x is odr-used here, so
                     // a definition is required
Run Code Online (Sandbox Code Playgroud)

c++ language-lawyer c++14

2
推荐指数
1
解决办法
284
查看次数

标签 统计

c++ ×1

c++14 ×1

language-lawyer ×1