上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页
摘要: 默认参数是静态绑定的,而虚函数是动态绑定的。 默认参数的使用要看指针或者引用本身的类型,而不是对象的类型 #include <iostream> using namespace std; class Base { public: virtual void fun ( int x = 10 ) { c 阅读全文
posted @ 2022-01-26 13:34 Wangtn 阅读(334) 评论(0) 推荐(0) 编辑
摘要: int n=1,m=2; const int* a=&n; cout<<*a<<endl; a=&m; cout<<*a<<endl; int* const b=&n; cout<<*b<<endl; *b=10; cout<<*b<<endl; const int* a中,const修饰变量,表示 阅读全文
posted @ 2022-01-25 10:37 Wangtn 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 类似于这个例子 #include <iostream> using namespace std; void sw(int a,int b) { int tmp=a; a=b; b=tmp; } void sw1(int* a,int* b) { int tmp; tmp=*a; *a=*b; *b= 阅读全文
posted @ 2022-01-06 11:04 Wangtn 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 参考 http://t.zoukankan.com/riskyer-p-3343268.html 为什么 for(auto i=map.begin();i!=map.end();++i) if(i.first==value) map.erase(i); 这种写法不行? 因为在这段代码中,i的自增是放 阅读全文
posted @ 2021-12-29 11:17 Wangtn 阅读(698) 评论(0) 推荐(0) 编辑
摘要: 原文链接 https://developer.nvidia.com/blog/how-overlap-data-transfers-cuda-cc/ 在我们上一篇 CUDA C/C++ 文章中,我们讨论了如何在主机和设备之间有效地传输数据。在这篇文章中我们将讨论数据传输与host端计算和device 阅读全文
posted @ 2021-12-21 18:02 Wangtn 阅读(565) 评论(0) 推荐(0) 编辑
摘要: 原文地址(host端就是cpu,device端就是gpu) https://developer.nvidia.com/blog/how-optimize-data-transfers-cuda-cc/ 在本系列的前三篇文章中,我们为该系列的主旨打下基础:如何优化cuda c代码。在这一篇和下一篇文章 阅读全文
posted @ 2021-12-21 11:31 Wangtn 阅读(913) 评论(0) 推荐(0) 编辑
摘要: 原文地址 https://developer.nvidia.com/blog/how-query-device-properties-and-handle-errors-cuda-cc/ 在cuda c/c++系列的第三篇博文中,我们讨论了各种支持cuda的gpu的各种特性,如何从cuda c/c+ 阅读全文
posted @ 2021-12-20 16:18 Wangtn 阅读(428) 评论(0) 推荐(0) 编辑
摘要: 原文链接 https://developer.nvidia.com/blog/how-implement-performance-metrics-cuda-cc/ 在上一篇文章中,我们通过cuda c实现SAXPY来了解了cuda c的一些基本知识。在这篇文章中我们将讨论如何分析此代码和其他cuda 阅读全文
posted @ 2021-12-20 13:54 Wangtn 阅读(467) 评论(0) 推荐(0) 编辑
摘要: 原文地址,纯翻译 https://developer.nvidia.com/blog/easy-introduction-cuda-c-and-c/ 这是cuda并行计算平台 c和c++接口系列的第一篇文章。学习前要求熟练掌握c,针对cuda fortran编程的帖子也会同步更新。这两个系列将涵盖c 阅读全文
posted @ 2021-12-17 17:24 Wangtn 阅读(1390) 评论(0) 推荐(0) 编辑
摘要: 闭包指内部函数对外部函数作用域里变量的引用 内部函数与外部函数: def func():#外部函数 print("this is func") def func1(num):#内部函数 print("this is func1") 由于内部函数的声明是在外部函数的作用域内,所以我们在外面是无法调用内 阅读全文
posted @ 2021-11-29 16:09 Wangtn 阅读(47) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页