如何理解 its lifetime begind with the evaluation of e 的句子
How to understand the sentence its lifetime began within the evaluation of e
int main(){
int v = 0;
int const& rf = v;
}
判断表达式int const& rf = v;
是否为核心常量表达式,需要经过这些引号:
an id-expression that refers to a variable or data member of reference type unless the reference has a preceding initialization and either:
- it is initialized with a constant expression or
- its lifetime began within the evaluation of e;
当计算表达式int const& rf = v;
时,引用类型的表达式rf
将是evaluted.For这个id-expression,它有一个前置初始化,但是v
不是一个常量expression.Does rf
的生命周期开始于int const& rf = v;
的求值范围内,我只是不知道如何理解within
。我只发现关于引用的生命周期规则是这里:
The lifetime of a reference begins when its initialization is complete. The lifetime of a reference ends as if it were a scalar object.
那么,这是its lifetime began within the evaluation of e;
的情况吗,如果不是,这里的关键字within
怎么理解?
beginning of that series of statements是:
An expression e
is a core constant expression unless the evaluation of e, following the rules of the abstract machine, would evaluate one of the following expressions:
int const& rf = v;
是声明,不是表达式。因此,询问它是否是一个核心常量表达式是没有意义的。你可以问 v
哪里是核心常量表达式。你可以问一下 rf
的一些 usage 是否是一个核心常量表达式。
但是你不能问一个声明是否是核心常量表达式。
至于怎么读"within",你就当普通英文读吧。 e
是一个表达式,上面引用的部分讲了它的求值。 "Within its evaulation" 将是其评估期间发生的事情的顺序。
int main(){
int v = 0;
int const& rf = v;
}
判断表达式int const& rf = v;
是否为核心常量表达式,需要经过这些引号:
an id-expression that refers to a variable or data member of reference type unless the reference has a preceding initialization and either:
- it is initialized with a constant expression or
- its lifetime began within the evaluation of e;
当计算表达式int const& rf = v;
时,引用类型的表达式rf
将是evaluted.For这个id-expression,它有一个前置初始化,但是v
不是一个常量expression.Does rf
的生命周期开始于int const& rf = v;
的求值范围内,我只是不知道如何理解within
。我只发现关于引用的生命周期规则是这里:
The lifetime of a reference begins when its initialization is complete. The lifetime of a reference ends as if it were a scalar object.
那么,这是its lifetime began within the evaluation of e;
的情况吗,如果不是,这里的关键字within
怎么理解?
beginning of that series of statements是:
An expression
e
is a core constant expression unless the evaluation of e, following the rules of the abstract machine, would evaluate one of the following expressions:
int const& rf = v;
是声明,不是表达式。因此,询问它是否是一个核心常量表达式是没有意义的。你可以问 v
哪里是核心常量表达式。你可以问一下 rf
的一些 usage 是否是一个核心常量表达式。
但是你不能问一个声明是否是核心常量表达式。
至于怎么读"within",你就当普通英文读吧。 e
是一个表达式,上面引用的部分讲了它的求值。 "Within its evaulation" 将是其评估期间发生的事情的顺序。