IS是[temp.res]/p8覆盖的[temp.dep.type]/p7
Is [temp.dep.type]/p7 covered by [temp.res]/p8?
[temp.dep.type]/p7:
如果合格的ID nested-name-depifier 是指当前的实例化不是当前实例化的成员或该计划甚至是未知专业化的成员,即使如果未实例化包含合格的ID 的模板;不需要诊断。同样,如果类成员访问表达式对象表达式的类型当前的实例化不是指当前成员实例化或未知专业的成员,该计划是即使包含成员访问的模板,也不明显表达不是实例化的;无需诊断。[示例:
template<class T> class A { typedef int type; void f() { A<T>::type i; // OK: refers to a member of the current instantiation typename A<T>::other j; // error: neither a member of the current instantiation nor // a member of an unknown specialization } };
- 结束示例]
[temp.res]/p8(省略了无关的部分(:
知道哪些名称是类型名称允许每个模板的语法被检查。该程序是不形式的,无需诊断,如果:
- 不能为模板或替代constexpr if语句和模板中的constexpr生成有效的专业化模板未实例化,或
...
[示例:
int j; template<class T> class X { void f(T t, int i, char* p) { t = i; // diagnosed if X::f is instantiated, and the assignment to t is an error p = i; // may be diagnosed even if X::f is not instantiated p = j; // may be diagnosed even if X::f is not instantiated } void g(T t) { +; // may be diagnosed even if X::g is not instantiated } };
...
- 结束示例]
我认为,如果满足[temp.dep.type]/p7中的条件,则无法为此模板生成有效的专业化(例如,在[temp的 example emame example 中.dep.type]/p7,对于声明typename A<T>::other j;
(,无法生成有效的专业化,因此该程序的形式不正确;根据[temp.res]/p8。
那么[temp.res]/p8涵盖的[temp.dep.type]/p7?如果没有,您能举个例子,即[temp.dep.type]/p7覆盖,但[temp.res]/p8不覆盖?
是的,[temp.dep.type]/p7确实被[temp.res]/p8覆盖。
现在[temp.dep.type]/p7通过p1787完全删除,示例的一部分添加到[temp.res]/8。
相关文章:
- 节点 *temp; 和节点 *tmp = 新节点之间的差异
- [temp.variadic]中关于包扩展实例化的措辞
- 使用未声明的标识符'temp'
- 将内容从第一个文件("constituencies")移动到第二个文件("temp")并在之后重命名时,我的文件被删除
- 引发异常:写访问冲突. temp 为 nullptr
- 使用显式模板参数列表和 [temp.arg.explicit]/3 的函数调用的演绎失败
- 链表指针赋值为什么我们不能直接将尾巴分配给 temp 而不是尾巴>尾巴下一个
- 在 C++ 中使用 temp 变量将节点添加到链表的末尾
- AppData\Local\Temp\cc59LXDc.o:test1.cpp: undefined reference to 'constructNewObjectOfClass
- 为什么我们要检查 temp == 是否为空?
- 'temp'未声明,请先使用此函数
- 如果 (QString.contains()) 不能正常工作,请使用 temp bool 变量进行更正
- IS是[temp.res]/p8覆盖的[temp.dep.type]/p7
- 在 temp.deduct.partial 中,为什么参数包的专用性较低?
- while(getline(myReadFile, temp, ':')) 执行一次迭代太多导致向量越界
- 将 rvalue/temp 对象传递给需要非成本引用的函数的任何方法
- C++-什么是指针数组版本的temp.pushback(temp[i])
- 删除用户 Temp 目录中的文件夹,但也要考虑 unicode 文件夹名称
- 在一行中使用带有"temp"结构的矢量回推(如果可能)
- 在 Visual Studio 中启用 DEP