Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
两阶段函数模板编译:第二阶段不*仅*使用ADL?
我想知道为什么以下代码 https wandbox org permlink lOVCxA1aY7HZejfV编译 include
c
templates
languagelawyer
argumentdependentlookup
namelookup
在模板化派生类中,为什么需要在成员函数内使用“this->”限定基类成员名称?
当我调查 Qt 的源代码时 我发现 trolltech 的人明确使用this关键字来访问析构函数上的字段 inline QScopedPointer T oldD this gt d Cleanup cleanup oldD this gt
c
QT
templates
This
namelookup
何时会出现 UB,因为 ADL 在实例化时未找到最佳重载匹配?
当函数体被实例化时 依赖函数调用重载解析应该通过ADL在关联的命名空间中找到最佳匹配 否则行为是未定义的 临时候选人 1 https timsong cpp github io cppwp n4861 temp dep candidate
c
templates
languagelawyer
undefinedbehavior
namelookup
什么是“参数相关查找”(又名 ADL 或“Koenig 查找”)?
关于什么是参数依赖查找有哪些好的解释 许多人也将其称为 Koenig Lookup 我最好想知道 为什么这是一件好事 为什么这是一件坏事 它是如何工作的 柯尼希查找 or 参数相关查找 http en wikipedia org wiki
c
argumentdependentlookup
namelookup
cfaq
为什么在使用“using namespace std;”时此代码中出现错误和“位/stdc++.h”?
实际上 这段代码在 DEV C 中运行良好 但是当我将其放入 Hacker Rank 面板时 它给出了这个错误 对函数的引用不明确 尽管所有在线编译器都给出了错误 我不认为这里函数重载会造成中断 因为这个错误主要来自函数重载 include
c
function
namespaces
ambiguous
namelookup
为什么可以通过重载决议来解决的程序因不明确而被拒绝?
以下程序因不明确而被 gcc 拒绝 struct Aint virtual void foo int struct Astring virtual void foo std string struct A public Aint publi
c
languagelawyer
namelookup
如何使基类中的所有隐藏名称在派生类中可访问?
从这个问题开始 从纯虚类 A 派生的指针无法访问纯类 B 的重载方法 https stackoverflow com questions 59756738 pointer derived from pure virtual classa c
c
namelookup
usingdeclaration
namehiding
定义模板后声明函数
假设我有一个模板函数 template
c
namelookup
条件运算符的返回类型和两阶段查找
考虑以下片段 struct Base struct Derived Base void f Base std cout lt lt f Base n template
c
languagelawyer
compilerbug
namelookup
dependentname
使用声明隐藏名称
include
c
SWAP
Using
argumentdependentlookup
namelookup
[over.load]/1 中下面突出显示的句子是什么意思?
下面突出显示的句子的含义是什么 它与函数模板有什么关系吗 过载 1 http eel is c draft over load 1 并非所有函数声明都可以重载 那些不能成为的 此处指定了重载 如果程序包含以下内容 则该程序是格式错误的 同一
c
overloading
languagelawyer
usingdirectives
namelookup
派生模板类对基类成员数据的访问
这个问题是对以下问题的进一步推进这个线程 https stackoverflow com questions 1117693 initializing template base class member types in derived
c
templates
inheritance
scope
namelookup
模板实例化、两阶段名称查找、自动推导类型的不同行为
看到这个问题后何时检查 C 模板实例化类型 https stackoverflow com q 34204483 2805305 并且很长一段时间以来我都在想同样的事情 我开始玩代码来吸收知识 答案给出了明确且正确的解释 它提到了两阶段名称
c
templates
languagelawyer
c14
namelookup
std::vector
的比较运算符无法找到 T 的比较运算符
以下非常简单的代码将无法编译 include
名称查找中的重载解析/歧义(哪一个)
7 3 3 14 C 03 struct A int x struct B A struct C A using A x int x int struct D B C using C x int x double int f D d ret
c
ambiguity
overloadresolution
namelookup
访问从模板类派生的类中的基成员函数[重复]
这个问题在这里已经有答案了 我正在工作中开发一个库 并且设计了一个复杂的继承 其中包括模板类并从中派生 我的问题是基模板类具有虚拟重载运算符 它接受 2 个参数并返回一些值 在基类中实现了此运算符 并且大多数派生类没有重新实现此运算符 其他
c
templates
inheritance
namelookup
templateinheritance
C++ 多重继承私有成员不明确访问
下面的代码 class A1 public int x class A2 private int x return 67 class M public A1 public A2 int main M m m x 编译有错误 error C2
c
multipleinheritance
accesscontrol
privatemembers
namelookup
名称查找和类范围
为什么setVal的返回类型是string类型 参数类型是double类型 typedef string Type Type initVal class Exercise public typedef double Type Type se
c
C11
scope
namelookup
classmembers
xlC 从模板函数问题中进行静态函数查找
当我在源代码中寻找有关编译问题的线索时 我遇到了这个错误报告 针对 Mozilla 的 JavaScript 引擎源代码 与函数查找相关 引用错误报告 TypedArrayTemplate 显然 是一个模板 它引用 INT TO JSVAL
c
templates
namelookup
xlc
关于用友元函数查找名字的问题
我已阅读 basic lookup unqual 的标准部分 对此我感到困惑 typedef int f namespace N struct A friend void f A operator int void g A a int i
c
C17
languagelawyer
friend
namelookup
1
2
»