![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
beauty
zhuxianjianqi
这个作者很懒,什么都没留下…
展开
-
error C2662: 不能将“this”指针从“const Node_align”转换为“Node_align &”解决方案
先贴代码void Insert2NodeAlign(int n1,int n2,int n3,int id){ Node_align DFStmp=Node_align(n1,false,n2,n3,id); DFSNL_i=DFS_Nlist.find(Node_align(DFStmp)); if (DFSNL_i!=DFS_Nlist.end()) { DFS原创 2013-05-17 11:47:06 · 2037 阅读 · 0 评论 -
关于C++ 里使用Openmp并行之cout混乱输出的解决方法
#pragma omp parallel {#pragma omp for for(int i=0;i<10;++i) std::cout<<i<<" "<<endl; // printf("%d \n",i); }很多技术书籍里面,Openmp实例都是用C写的,可很多用户在自己练习的时候都喜欢用自己熟悉的原创 2012-03-09 10:52:34 · 3700 阅读 · 2 评论 -
cuda编程优化小技巧之分支优化
cuda编程优化原则之一就是要减少分支分支优化 消除分支结构的小技巧 例如:if( a>b ){a=c;} else {a=0;} 可以替换为:a=( a>b )*c;原创 2013-05-07 10:33:37 · 1970 阅读 · 2 评论 -
IVF实现时间函数
#include #include "time.h"#ifdef _cplusplusextern "C" void{#endif#define timef TIMEF extern void __stdcall timef( double *);#ifdef _cplusplus}#endifvoid __stdcall timef(double *timenow){原创 2012-06-29 17:07:14 · 960 阅读 · 0 评论 -
一些常用的字符操作函数
#include template string ConvertToString(T value) { stringstream ss; ss << value; return ss.str();}string Align_Left(const string &showdata, int space ) { //int spacelong=atoi(spa原创 2012-04-09 11:19:27 · 831 阅读 · 0 评论 -
cuda编程之数据更新小技巧
不知道大家有没有遇到这样的情况:在某个迭代计算过程中,数组new的计算需要old的值,当计算完成后,需要把new的值写入old再下一次迭代?如果这里使用memcpy的方式,当数据量较大的时候会很耗时的!解决方法:交换指针也就是把指向设备内存new和old的指针进行交换,这样就避免了memcpy的时间消耗~当然用过的人无视以上内容~交换方法:定义一个函数voi原创 2013-05-09 23:57:57 · 1204 阅读 · 0 评论 -
从输入流一次返回一行的iterator
// VC6[x] BCB4[x] GCC295[o]#include #include #include #include using namespace std;class line_iterator{ istream* in; string line; bool is_valid; void read() { if (*in) getli原创 2012-04-23 18:45:51 · 619 阅读 · 0 评论 -
一种优化的字符串排序 泛型算法
// VC6[o] BCB4[o] GCC295[o]#include #include #include #include #include using namespace std;struct strtab_cmp{ typedef vector::iterator strtab_iterator; bool operator()(const pair& x原创 2012-04-23 19:12:24 · 616 阅读 · 0 评论