作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在LWG 3182中,它指出
The specification of the
Same
concept in 18.4.2 [concept.same]:template<class T, class U>
concept Same = is_same_v<T, U>;
-1- Same<T, U> subsumes Same<U, T> and vice versa.seems contradictory. From the concept definition alone, it is not the case that
Same<T, U>
subsumesSame<U, T>
nor vice versa.
... Commutativity is satisfied, i.e. for any two types
T
andU
,is_same<T, U>::value == true
if and only ifis_same<U, T>::value == true
.
Same<T, U>
被定义为
is_same_v<T, U>
,
Same<T, U>
如何不包含
Same<U, T>
?
最佳答案
该问题涉及标准概念Same
,该概念已重命名为same_as
,并已由
将其指定为[concept.same]:
template<class T, class U>
concept same-as-impl = is_same_v<T, U>; // exposition only
template<class T, class U>
concept same_as = same-as-impl<T, U> && same-as-impl<U, T>;
Same<T, U>
不包含
Same<U, T>
)
same-as-impl
的原因。
关于c++ - Same <T,U>为什么不包含Same <U,T>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60145452/
我是一名优秀的程序员,十分优秀!