`decltype`含有多个参数的含义 [英] Meaning of `decltype` with more than one argument
问题描述
我找到了一个 decltype
相关问题及其答案其中
OP和回答者似乎假定
decltype(t,u)
是取决于 t
和 u
。
I have found a decltype
-related question and its answers in which
both the OP and the answerers seem to assume that
decltype(t,u)
is something that depends on the types of both t
and u
.
链接问题中的 decltype(t,u)
是与
兼容的最小类型 t
和 u
,在某种意义上最小和兼容。
如果它的含义类似于§5(9)中的常见类型或者 std :: common_type $ c $的定义中的
c>从§20.9.7.6(3),那么意思是
decltype(true?t:u)
。
I suppose that the intended meaning of the decltype(t,u)
in the linked question is that of a minimal type compatible with
both t
and u
, in some sense of minimal and compatible.
If it is meant like a common type as in §5(9) or in the definition
of std::common_type
from §20.9.7.6(3), then the intended meaning would be
decltype(true ? t : u)
.
但是,似乎C ++ 11只定义了一个参数 decltype
。
也就是说,解析器指定接受 decltype(
表达式 )
其中 可以是以逗号分隔的 assignment-expression 列表。
从§7.1.6.2(4)重新读取 decltype
的规范,
我必须解释 decltype ,u)
为 decltype((u))
。
However, it seems that C++11 defines only a one-argument decltype
.
That said, the parser is specified to accept decltype(
expression )
where expression can be a comma-separated list of assignment-expression.
Re-reading the specification of decltype
from §7.1.6.2(4),
I have to interpret decltype(t,u)
as decltype((u))
.
是 decltype(t,u)
实际上?我缺少一些东西?
Question: So what is decltype(t,u)
actually? Am I missing something?
编辑:作为答案收敛于这是逗号运算符,我仍然想看到
你的判断, decltype((u))
(声明类型的引用)或 decltype(u)
。
As answers converge on "this is the comma operator", I'd still like to see
your judgement on whether it's decltype((u))
(a reference to the declared type) or decltype(u)
(the declared type). I suspect the former.
推荐答案
这里的逗号是运算符,不是参数分隔符
Comma here is the operator, not argument separator
这篇关于`decltype`含有多个参数的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!