
c++
文章平均质量分 67
wusoule
这个作者很懒,什么都没留下…
展开
-
2011-2012工作总结
*********************************************************************************** 工 具 ***********************************原创 2013-04-07 11:08:46 · 1101 阅读 · 0 评论 -
在c#中调用并调试C++的DLL
http://www.cnblogs.com/sunrack/articles/852448.html被C#调用的DLL一般只需要把导出的函数以适当的形式呈现即可调用,比如extern "C" __declspec(dllexport)BOOL Integrate3 (){...},这样的函数,在C#里面声明如:[DllImport("xxx.dll", Calling转载 2013-09-26 17:03:02 · 1856 阅读 · 0 评论 -
C#调用非托管C++DLL中的函数
http://www.debugease.com/csharp/550953.html最近一个项目需要用C#调用非托管C++DLL中的函数接口(有生成的DLL文件和Lib文件),C++的函数接口的参数中使用了Vector及Vector结构(m_Struct表示自定义的结构体),参考了网上的一些资料:1、如果直接使用C#调用(http://blog.youkuaiyun.com/pansiom/ar转载 2013-09-25 12:39:30 · 2243 阅读 · 0 评论 -
提高程序运行效率的10个简单方法
对于每一个程序员来说,程序的运行效率都是一个值得重视,并为之付出努力的问题。但是程序性能的优化也是一门复杂的学问,需要很多的知识,然而并不是每个程序员都具备这样的知识,而且论述如何优化程序提高程序运行效率的书籍也很少。但是这并不等于我们可以忽略程序的运行效率,下面就介绍一下本人积累的一些简单实用的提高程序运行效率的方法,希望对大家有所帮助。注:以C/C++程序为例转载 2013-07-02 12:42:04 · 1029 阅读 · 0 评论 -
C++中怎么进行string转化为double等类型转换
http://blog.youkuaiyun.com/jia_xiaoxin/article/details/3070652Method 1:使用C的atoi()和atof()。先利用c_str()转成C string,再用atoi()与atof()。#include #include #include using namespace std;转载 2013-05-29 09:19:23 · 22446 阅读 · 0 评论 -
一个项目中的STL类型的选择和算法实现
1.描述:我的类中需要存放strin类型的数据,而且需要和数据连接,实时跟新该容器的数据。2,我的思路:起初:我打算用一个vector就可以啦~后来:我否决了,并不是我觉得vecotr不好,正式因为我想的算法促使我选择不用vector。3,算法:起初:我用了个很拙楼的算法:假设vFrom是实时得到的数据(新的),vTo是我类中保存的数据(原创 2013-05-26 16:55:53 · 1427 阅读 · 0 评论 -
STL的list的erase问题
http://www.cnblogs.com/carekee/articles/1717921.htmllist使用中遇到的erase问题(List Iterator Not Incrementable)在VS2005中使用list的erase遇到了"List Iterator Not Incrementable"问题举个例子:1.list sList;list转载 2013-05-26 16:58:48 · 919 阅读 · 0 评论 -
auto_ptr
http://www.cppblog.com/SmartPtr/archive/2007/07/05/27549.htmlauto_ptr解析By SmartPtr(http://www.cppblog.com/SmartPtr/)auto_ptr是当前C++标准库中提供的一种智能指针,或许相对于boost库提供的一系列眼花缭乱的智能指针, 或许相对于Loki中那个无所不包转载 2013-05-09 14:53:44 · 609 阅读 · 0 评论 -
c++ 把文件转换成string
fstream fs;string line,str;fs.open("D::\\txt");if (!fs) { cout << "cannot open the file" << endl; return -1;}while (getline(fs, line)) { line += '\n'; str += line;}原创 2013-05-21 12:17:49 · 3274 阅读 · 1 评论 -
c++中 mutable 关键字的典型应用
http://blog.chinaunix.net/uid-174325-id-1744029.html原来一直很少用mutable这个关键字,最近遇到了一个自己觉得很合适应用mutable的地方:在多线程环境里面,有一个Config类中保存了很多的配置属性。 这些属性有可能在某些地方会被修改,在其它的地方会被读取,因为在多线程环转载 2013-05-22 09:12:08 · 784 阅读 · 0 评论 -
模板类要注意的地方
1,写模板类,它的实现一般写在.h文件中。为什么呢?呵呵~~因为,编译器不知道用这个类的地方的符号是何物,所以把责任留给了连接器。若,你把模板类的实现写在.cpp中,呵呵~~根据模板的特性,只在用到它的地方实例化。呵呵~~所以,压根模板就没有实例化。所以,连接错误。当然,为什么编译器不多做点工作呢。效率吧~~2,怎么写一个模板类template class A{p原创 2013-05-21 21:58:48 · 1111 阅读 · 0 评论 -
string与string头文件
先来段代码。我是在vs2012上实验的:// priority_queue.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include //#include //#include using namespace std;int _tmain(int argc,原创 2013-05-05 17:32:04 · 2447 阅读 · 0 评论 -
STL——map
代码自有黄金屋http://www.kuqin.com/cpluspluslib/20071231/3265.html//1这是一个一般用法的例子。// priority_queue.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #incl原创 2013-05-05 18:21:38 · 886 阅读 · 0 评论 -
priority_queue
题记:可能项目中会要用到“priority_queue”,提前预习啦~实践中出真知,见下面的代码:代码// priority_queue.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include using name原创 2013-05-05 15:41:03 · 964 阅读 · 0 评论 -
在C++中通过模板规避潜在错误
还是那句话,感谢李云的付出。出处:点击打开链接http://yunli.blog.51cto.com/831344/864759注:本文节选自我正在创作的第二本书《C++跨平台与框架开发》,其中一些措词并未就博文进行调整,阅读时请注意。 模板(template)为C++带来了泛型编程的能力,但也带来了使用难度。大体上,使用模板的三转载 2013-05-01 19:39:06 · 667 阅读 · 0 评论 -
手贱,写写sem玩玩——semA
#include #include #include #include #include int semid;union semun { int val; struct semid_ds *buf; unsigned short *array; struct seminfo *__buf;};void handle(int s){ printf("ctrl +原创 2013-04-11 10:57:55 · 817 阅读 · 0 评论 -
Expression:invalid operator<断言
#include #include using namespace std;/*** 测试目的:重现断言,"include\xtree Line:1746 Expression:invalid operator** 重现手法:operator** 结论:map[key] = value.key重复是不会导致以上断言,而是比较函数写法错误*/struct Te原创 2014-02-17 12:28:55 · 1880 阅读 · 0 评论