什么价值有名? [英] What rvalues have names?

查看:155
本文介绍了什么价值有名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@ Credoverflow在C ++聊天室中提及 是具有名称的右值的罕见情况。 C ++ 0x FDIS在下提及5.1.1 [expr.prim.general] p4

@FredOverflow mentioned in the C++ chatroom that this is a rare case of rvalues that have names. The C++0x FDIS mentions under 5.1.1 [expr.prim.general] p4:


否则,如果成员声明器声明类X的非静态数据成员(9.2), 这个在可选的大括号或初始值化程序中键入指向X的指针。它不会出现在成员声明器的其他地方。 (强调我)

Otherwise, if a member-declarator declares a non-static data member (9.2) of a class X, the expression this is a prvalue of type "pointer to X" within the optional brace-or-equal-initializer. It shall not appear elsewhere in the member-declarator. (emphasis mine)

还有其他人在哪里吗?

推荐答案

一个突出的例子是枚举器

One prominent case are enumerators

enum arity { one, two };

表达式一个 two 是右值(更具体地说,是C ++ 0x中的prvalues)。另一个是模板非类型参数

The expressions one and two are rvalues (more specifically, prvalues in C++0x). Another are template non-type parameters

template<int *P> struct A { };

表达式 P 更具体地说,C ++ 0x中的prvalue)。

The expression P is an rvalue too (more specifically again, a prvalue in C++0x).

这篇关于什么价值有名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆