- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在temp.deduct.partial#8 ,有一个例子:
template<class... Args> void f(Args... args); // #1
template<class T1, class... Args> void f(T1 a1, Args... args); // #2
template<class T1, class T2> void f(T1 a1, T2 a2); // #3
f(); // calls #1
f(1, 2, 3); // calls #2
f(1, 2); // calls #3; non-variadic template #3 is more specialized
// than the variadic templates #1 and #2
第 1 次调用很简单,因为只有一个可行的特化。
对于调用 #2,f₁
和 f₂
是可行的。我们合成了 f₁(X)
和 f₂(X, Y)
。然后我们以两种方式进行类型推导。
首先 f₂(X, Y)
对 f₁(Args... args)
,推导出 Args
为 X , Y
。
然后 f₁(X)
对抗 void f₂(T1 a1, Args... args)
,将 T1
推导为 X
,Args
为空。
所以演绎在两种方式上都成功,而且没有一种比另一种更专业。
我们能被temp.deduct.partial#11拯救吗? ?
If, after considering the above, function template F is at least as specialized as function template G and vice-versa, and if G has a trailing parameter pack for which F does not have a corresponding parameter, and if F does not have a trailing parameter pack, then F is more specialized than G.
这看起来没有帮助。设 F=f₁, G=f₂
,则 G
确实有一个 F
没有相应参数的尾随参数包。但是 F
有一个尾随参数包,所以这不适用。
我是否误读了标准中的任何内容,或者答案是否完全可以在其他地方找到?
最佳答案
这是 answered由西蒙·布兰德在推特上发布。关键在temp.deduct#type-10.2 :
During partial ordering, if Ai was originally a function parameter pack: (...) if Pi is not a function parameter pack, template argument deduction fails.
在这种情况下,当针对 f₂(T1 a1, Args... args)
执行 f₁(X)
时,X
最初是一个函数参数包。 T1
不是函数参数包,因此推导失败。
由于我们可以从 f₂
推导出 f₁
,但反之则不行,因此 f₂
更专业。
关于c++ - 在 temp.deduct.partial 中,为什么参数包不够专业?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54980350/
for x in [temp for temp in xlist if temp xmax: continue 会起作用。 (你的 for 循环的其余部分是做什么的?)如果它可以只使用一个 list-
我正在学习 C 的 udemy 类(class),发现这个问题不是都声明是相同的吗?如果是,为什么答案不同 源代码: #include void swap(int *a, int *b){
#include #include void test( int * ); struct node { int data; struct node * next; }; int m
所以我在练习一些链表问题,但我一直把假设弄混了//这是一个只有头部的单向链表 // what is the difference between ListNode temp = head; while
我有一个 Windows Server 2008 32 位,当我输入 %temp% 时,它会将我带到 ..AppData\Local\Temp\1\或 ..AppData\Local\Temp\2 而
在学习链表编码的过程中,我遇到了这两个东西,无法理解它们之间的区别,让我感到困惑。我一直在学习的这本书在我们在链表末尾添加新节点的部分解释了“temp=*q”。 So, if the list is
谁能说出下面代码的内部过程 //instead of 1 it displays -1 最佳答案 echo ~$temp; ^bitwise not operator 假设 32 位
我想知道hadoop.tmp.dir和mapred.temp.dir有什么区别,而且mapred.temp.dir [不建议使用]与mapreduce.cluster.temp.dir有何不同 最佳答
我的输入来自使用 DataInputSteam 的 socket,并且因为我可以将多个不同的字符串值全部分配给同一个 clientDayOfWeek 字符串,我无法弄清楚如何将进入同一个 ArrayL
在做一些基于二叉搜索树的问题时......我在函数调用中有点困惑: void find(node* root,node*& temp) { blah blah... } int main()
为什么下面的代码不起作用?据我所知,当 temp 达到 NULL 时,(new)ing 它应该创建一个 temp 指向它的新节点。奇怪的是,将 while 条件更改为 temp->next!=NULL
我有一个 JMenuItem 实例(比如说 TEMP)。我想知道添加了 TEMP 的 JMenu 的名称是什么。我该怎么做? 最佳答案 您可以尝试以下代码来获取给定 JMenuItem 的 JMenu
我得到了相同的结果,有什么区别?哪个更好?temp 是一个 int,从 reader.read() 读取 System.out.print((char)temp); System.out.print(
我试图通过以下示例中的 temp 变量检查“temp = ( volatile 无符号短*) add ”中的添加值: main() { unsigned short add = 0x01;
我有一个网络作业,在 %temp% 文件夹中写入一些数据,该文件夹映射到 d:\local\temp。 当我在 Azure 门户上使用控制台工具时,数据就在那里,位于 d:\local\temp 上。
我有下面的内容,用作启动 powershell 的批处理文件(太长,无法详细介绍,但它在另一个脚本中使用)。 无论如何,我注意到 %systemroot%\temp 和 %systemroot% 不起
我尝试在这里和整个 Internet 上进行研究,但由于伪代码编写相当多样化,许多人使用不同的符号来表示不同的事物,我找不到任何可能符合我的问题的内容。 给定以下内容:n 阶数组 A(不一定已经排序)
Replace Temp with Query 重构方法现在被广泛推荐,但是似乎效率很低, yield 很小。 Martin Fowler 网站的方法给出了以下示例: 将表达式提取到方法中。用表达式替
当我们有什么操作需要使用到命令的就可以打开运行,然后直接向里面输入命令就可以完成一些操作。因为有用户想知道%temp%输入命令行是什么意思,所以小编就来为大家解答了这个命令的意思,它一般是用于清除垃
我知道之前有人问过这方面的变体(例如 https://groups.google.com/forum/#!topic/snakemake/4kslVBX2kew ),但我没有看到明确的解决方案。 如果
我是一名优秀的程序员,十分优秀!